/* Not Social Media — identidade "rota de fuga"
 * Cyberpunk de beco, não de vitrine: neon ciano (saída) + rosa choque
 * (rebelião) sobre azul-violeta blecaute. Os jogos herdam a paleta
 * pelas variáveis; a assinatura é o risco neon piscando sobre "social". */
:root {
  --bg: #0a0c14;         /* blecaute */
  --surface: #11141f;    /* bunker */
  --surface-2: #1a1e2f;  /* conduíte */
  --text: #e6ecf5;
  --text-dim: #7e88a2;
  --accent: #45f0c7;     /* neon "saída" */
  --accent-2: #ff3d7f;   /* rosa "rebelião" */
  --display: 'Chakra Petch', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --topbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* CRT: scanlines quase subliminares sobre tudo (só atmosfera) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0 1px, transparent 1px 4px);
  opacity: 0.06;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Top bar ---- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 12, 20, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 30;
}
/* Linha de sinal: ciano vira magenta — a transmissão pirata do site */
.topbar::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent-2) 72%, transparent);
  opacity: 0.55;
}

/* Marca: letreiro neon com a negação como assinatura */
.brand {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--text);
  text-shadow: 0 0 14px rgba(69, 240, 199, 0.28);
}
.brand span {
  position: relative;
  color: var(--text-dim);
  margin: 0 2px;
}
/* O risco sobre "social" pisca como neon com mau contato */
.brand span::after {
  content: '';
  position: absolute;
  left: -3%;
  right: -3%;
  top: 54%;
  height: 2.5px;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2), 0 0 20px rgba(255, 61, 127, 0.5);
  animation: neon-strike 7s infinite;
}
@keyframes neon-strike {
  0%, 41%, 45%, 74%, 77%, 100% { opacity: 1; }
  42%, 44% { opacity: 0.25; }
  75%, 76% { opacity: 0.4; }
}

.topbar-actions {
  display: flex;
  align-items: center;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.icon-btn:active { background: var(--surface-2); }

/* Botão do menu: moldura neon — a porta de saída para os outros jogos */
.menu-pill {
  width: auto;
  height: 40px;
  padding: 0 14px 0 12px;
  gap: 8px;
  background: rgba(69, 240, 199, 0.07);
  border: 1px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(69, 240, 199, 0.22), inset 0 0 8px rgba(69, 240, 199, 0.06);
}
.menu-pill:active {
  background: rgba(69, 240, 199, 0.18);
}
.menu-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s, opacity 0.2s;
}
.icon-btn[aria-expanded="true"] .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.icon-btn[aria-expanded="true"] .hamburger span:nth-child(2) { opacity: 0; }
.icon-btn[aria-expanded="true"] .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Drawer ---- */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 82vw);
  background: var(--surface);
  border-right: 1px solid var(--surface-2);
  z-index: 40;
  padding: calc(var(--topbar-h) + var(--safe-top) + 8px) 16px calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}
.drawer.open { transform: translateX(0); }

/* Tagline como prompt de terminal, com cursor vivo */
.drawer-tagline {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.78rem;
  margin-bottom: 16px;
}
.drawer-tagline::before { content: '> '; color: var(--accent-2); }
.drawer-tagline::after {
  content: '_';
  animation: cursor-blink 1.1s steps(1) infinite;
}
@keyframes cursor-blink { 50% { opacity: 0; } }

.game-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}
.view-toggle {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  margin-bottom: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
}
.view-toggle button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.view-toggle button.active { background: var(--surface); color: var(--accent); }

/* Categorias com prefixo de comentário: o menu é código do submundo */
.game-list .drawer-cat {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 10px 6px;
  border-bottom: 1px solid var(--surface-2);
  margin-bottom: 4px;
}
.game-list .drawer-cat::before { content: '// '; color: var(--accent-2); }
.game-list .drawer-cat:first-child { padding-top: 4px; }
.game-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 6px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.game-list button:active { background: var(--surface-2); }
.game-list button.active {
  background: var(--surface-2);
  outline: 1px solid var(--accent);
  box-shadow: 0 0 10px rgba(69, 240, 199, 0.15);
}
.game-list .g-emoji { font-size: 1.4rem; }
.game-list .g-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.02em; }
.game-list .g-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: 2px;
}

.random-btn {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--accent-2);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}
.random-btn:active { background: rgba(255, 61, 127, 0.12); }

.drawer-note {
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 11, 0.55);
  z-index: 35;
  opacity: 0;
  transition: opacity 0.25s;
}
.overlay.show { opacity: 1; }

/* ---- Stage (game area) ---- */
.stage {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top));
  left: 0;
  right: 0;
  bottom: 0;
}
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Toast used by shell when switching games */
.game-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--surface-2);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 14px;
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  max-width: 88vw;
  z-index: 20;
  pointer-events: none;
  animation: toast-fade 3.1s ease forwards;
}
.game-toast small {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--accent);
  line-height: 1.4;
}
@keyframes toast-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- Toques de identidade nos popups dos jogos (common.js) ----
 * Só propriedades que o CSS injetado não define: nada é sobrescrito. */
.ns-end-card { border: 1px solid rgba(69, 240, 199, 0.18); }
.ns-intro-name { font-family: var(--display); letter-spacing: 0.04em; }
.ns-end-score { font-family: var(--display); }
.ns-end-title { font-family: var(--mono); font-size: 0.8rem; }

/* ---- Acessibilidade: sem flicker para quem prefere calma ---- */
@media (prefers-reduced-motion: reduce) {
  .brand span::after,
  .drawer-tagline::after {
    animation: none;
  }
}
