:root {
  color-scheme: dark;
  --bg: #090d18;
  --bg2: #0e1424;
  --panel: #141b2d;
  --panel2: #1b2440;
  --line: rgba(255, 255, 255, .08);
  --text: #eef2ff;
  --muted: #8b96b3;
  --accent: #00d4ff;
  --accent-strong: #2563eb;
  --accent2: #ffc61a;
  --shadow: 0 6px 16px rgba(0, 0, 0, .45);
  --shadow-hover: 0 14px 30px rgba(0, 0, 0, .6);
  --glow: 0 0 0 2px var(--accent), 0 0 22px rgba(0, 212, 255, .45);
  --cell: 94px;
  --gap: 16px;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: 'Exo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(0, 212, 255, .16), transparent 70%),
    radial-gradient(ellipse 60% 40% at 95% 0%, rgba(37, 99, 235, .18), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px, 100% 100%;
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.page { padding: var(--gap); max-width: 1900px; margin: 0 auto; }

/* ---------- Grade estilo Poki ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--cell));
  grid-auto-rows: var(--cell);
  grid-auto-flow: dense;
  gap: var(--gap);
  justify-content: center;
}

.tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(145deg, var(--c1, #60a5fa), var(--c2, #1d4ed8));
  box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .18s;
  user-select: none;
}
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 15%, rgba(255, 255, 255, .25), transparent 50%);
}
.tile:hover, .tile:focus-visible {
  transform: scale(1.05) translateY(-2px);
  box-shadow: var(--glow), var(--shadow-hover);
  z-index: 2;
  outline: none;
}


.tile-letter {
  position: relative;
  font-family: 'Russo One', 'Exo 2', sans-serif;
  font-size: 44px;
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 4px 8px rgba(0, 0, 0, .25);
}
.tile-big .tile-letter { font-size: 100px; }
.tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: transform .25s;
}
.tile:hover .tile-img { transform: scale(1.06); }
.tile-title, .badge { z-index: 2; }

.tile-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 8px 8px;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(5, 8, 16, .9));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s, transform .18s;
}
.tile-big .tile-title { font-size: 18px; padding: 30px 12px 14px; }
.tile:hover .tile-title, .tile:focus-visible .tile-title { opacity: 1; transform: none; }
@media (hover: none) {
  .tile-title { opacity: 1; transform: none; }
}

.tile-big { grid-column: span 2; grid-row: span 2; }

.badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent2);
  color: #111;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}

/* Categorias */
.tile-cat {
  grid-column: span 2;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  color: var(--text);
}
.tile-cat::before { display: none; }
.cat-emoji { font-size: 34px; }
.cat-name { font-weight: 700; font-size: 16px; }

/* ---------- Painel do logo ---------- */
.nav-panel {
  grid-column: 1 / span 2;
  grid-row: 1;
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  width: 36px;
  height: 36px;
  flex: none;
  filter: drop-shadow(0 0 10px rgba(0, 212, 255, .35));
  transition: transform .2s;
}
.logo:hover .logo-icon { transform: rotate(-8deg) scale(1.08); }
.logo-text {
  font-family: 'Russo One', 'Exo 2', sans-serif;
  font-size: 23px;
  line-height: 1;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #fff;
}
.logo-text b {
  font-weight: 400;
  background: linear-gradient(90deg, var(--accent), #4f8bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav-buttons { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: rgba(0, 212, 255, .14); border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Títulos de seção ---------- */
.section-title {
  grid-column: 1 / -1;
  height: var(--cell);
  display: flex;
  align-items: flex-end;
  margin: 0;
  padding: 0 4px 6px;
  font-family: 'Russo One', 'Exo 2', sans-serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: .3px;
}
.grid + .grid { margin-top: var(--gap); }
.section-title.hero {
  grid-column: 3 / -1;
  align-items: center;
  font-size: 28px;
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0 24px;
  gap: 12px;
}
.empty {
  grid-column: 1 / -1;
  grid-row: span 2;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  padding: 16px;
}

/* ---------- Página do jogo ---------- */
.game-box {
  grid-column: 1 / -1;
  grid-row: span 6;
  display: flex;
  flex-direction: column;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
}
.game-box iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #111;
  display: block;
}
.game-bar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--text);
}
.game-bar .g-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.game-bar .g-title { font-family: 'Russo One', 'Exo 2', sans-serif; font-weight: 400; font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-bar .icon-btn.active { background: #ff3d5a; border-color: #ff3d5a; color: #fff; }

.game-info {
  grid-column: 1 / -1;
  grid-row: span 3;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  overflow: auto;
}
.game-info h1 { margin: 0 0 6px; font-family: 'Russo One', 'Exo 2', sans-serif; font-weight: 400; font-size: 24px; }
.game-info p { color: #c9d1e6; }
.game-info p { margin: 6px 0; line-height: 1.5; }
.game-info .label { font-weight: 700; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, .35);
  background: rgba(0, 212, 255, .08);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.chip:hover { background: rgba(0, 212, 255, .2); }

/* Em telas largas, o jogo fica ao lado do painel do logo, como no Poki */
@media (min-width: 1100px) {
  .game-box { grid-column: 3 / span 8; grid-row: 1 / span 6; }
  .game-info { grid-column: 3 / span 8; }
}
@media (min-width: 1540px) {
  .game-box { grid-column: 3 / span 10; grid-row: 1 / span 7; }
  .game-info { grid-column: 3 / span 10; }
}
@media (max-width: 1099px) {
  .game-box { grid-row: auto; height: min(75vh, 620px); }
}

.game-box:fullscreen { border-radius: 0; }

/* ---------- Busca ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 7, 15, .8);
  backdrop-filter: blur(4px);
  display: none;
  overflow: auto;
}
.search-overlay.open { display: block; }
.search-panel {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
}
.search-input-wrap {
  display: flex;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-hover);
  margin-bottom: var(--gap);
}
.search-input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  padding: 8px 12px;
  background: transparent;
  color: var(--text);
}
.search-hint { color: var(--muted); font-weight: 700; margin: 0 0 12px 4px; }

.footer {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  padding: 32px 16px 24px;
}

@media (max-width: 560px) {
  :root { --cell: 72px; --gap: 10px; }
  .tile-letter { font-size: 36px; }
  .tile-big .tile-letter { font-size: 72px; }
  .logo-text { font-size: 17px; }
  .logo-icon { width: 28px; height: 28px; }
  .logo { gap: 6px; }
  .icon-btn { width: 34px; height: 30px; }
  .section-title { font-size: 18px; }
  .section-title.hero { font-size: 22px; padding: 0 14px; }
  .cat-emoji { font-size: 26px; }
  .cat-name { font-size: 13px; }
  .tile-cat { padding: 0 10px; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile-img, .tile-title { transition: none; }
}
