:root {
  --accent:      #c8ff00;
  --text:        #f0ead6;
  --muted:       rgba(240, 234, 214, 0.45);
  --card-bg:     rgba(10, 10, 10, 0.72);
  --card-border: rgba(200, 255, 0, 0.15);
  --radius-pill: 200px;
  --radius-card: 18px;
  --font-heading: "consolas", sans-serif;
  --font-mono:    "consolas", monospace;
  --debug: 0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: calc(var(--debug) * 1px) solid red;
}

html { min-height: 100%; }

body {
  min-height: 100vh;
  background: #000;
  color: var(--text);
  font-family: var(--font-heading);
  overflow-x: hidden;
}

/* ── NAV ──────────────────────────────────────────────────────────────────── */

#main {
  display: flex;
  justify-content: center;
  padding-top: 2%;
  position: relative;
  z-index: 10;
}

#nunnigation {
  width: min(95vw, 420px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 10px 12px;
  background-color: rgba(5, 5, 5, 0.4);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(200, 255, 0, 0.18);
  border-radius: var(--radius-pill);
}

#image.naa { margin-right: 0; }

img {
  display: block;
  border-radius: 8px;
}

.naa {
  display: flex;
  align-items: center;
  gap: 20px;
}

a {
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
  transition: 0.2s;
}

a:hover {
  opacity: 1;
  color: var(--accent);
}

/* ── HERO ─────────────────────────────────────────────────────────────────── */

#hero {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 60px 20px 40px;
}

#hero h1 {
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

#hero h1 span { color: var(--accent); }

#hero-count {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ── LAUNCHER ─────────────────────────────────────────────────────────────── */

#launcher {
  position: relative;
  z-index: 5;
  max-width: 980px;
  margin: 0 auto 60px;
  padding: 0 16px;
}

#launcher-top {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

#gsearch {
  flex: 1;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

#gsearch::placeholder { color: var(--muted); }
#gsearch:focus { border-color: rgba(200, 255, 0, 0.5); }

#gcount {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* ── CATEGORY BAR ─────────────────────────────────────────────────────────── */

#cat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cat-btn {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.4);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}

.cat-btn:hover {
  border-color: var(--cat-c, var(--accent));
  color: var(--cat-c, var(--accent));
  background: rgba(255,255,255,0.05);
}

.cat-btn.cat-active {
  background: var(--cat-c, var(--accent));
  border-color: var(--cat-c, var(--accent));
  color: #000;
  font-weight: 700;
}

/* horror active gets a darker text */
.cat-btn[data-cat="horror"].cat-active { color: #fff; }

.cat-count {
  opacity: 0.65;
  font-size: 10px;
}

.cat-btn.cat-active .cat-count { opacity: 0.7; }

/* ── GAME GRID ────────────────────────────────────────────────────────────── */

#game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

#game-grid::-webkit-scrollbar          { width: 4px; }
#game-grid::-webkit-scrollbar-track    { background: transparent; }
#game-grid::-webkit-scrollbar-thumb    { background: rgba(200,255,0,0.25); border-radius: 4px; }

.gbtn {
  position: relative;
  padding: 9px 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.gsrc-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--badge-color, var(--accent));
  opacity: 0.8;
  text-transform: uppercase;
}

.gbtn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* horror cards get red tint */
.gbtn:has(.gsrc-badge[style*="ff3c3c"]):hover {
  background: rgba(255, 60, 60, 0.1);
  border-color: rgba(255, 60, 60, 0.35);
}

.gbtn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.gbtn.active .gsrc-badge { color: rgba(0,0,0,0.45); }

/* ── FRAME WRAPPER ────────────────────────────────────────────────────────── */

#fwrap {
  position: relative;
  margin-top: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ── FRAME TOP BAR ────────────────────────────────────────────────────────── */

#fbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--card-border);
}

#ftitle {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}

#ftitle.active-title { color: var(--accent); }

#btn-r,
#btn-fs,
#btn-e {
  display: none;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid rgba(200, 255, 0, 0.3);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s;
  white-space: nowrap;
}

#btn-r:hover,
#btn-e:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

#btn-fs {
  border-color: rgba(0, 212, 255, 0.35);
  color: rgba(0, 212, 255, 0.7);
}

#btn-fs:hover {
  background: #00d4ff;
  border-color: #00d4ff;
  color: #000;
}

/* ── LOADING ──────────────────────────────────────────────────────────────── */

#loading-msg {
  display: none;
  width: 100%;
  height: min(75vh, 900px);
  min-height: 420px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(200, 255, 0, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── PLACEHOLDER ──────────────────────────────────────────────────────────── */

#ph {
  width: 100%;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
}

#ph svg  { width: 48px; height: 48px; opacity: 0.3; }

#ph p {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}

/* ── GAME HINT (not loading banner) ──────────────────────────────────────── */

#game-hint {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,100,100,0.35);
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,180,180,0.9);
  white-space: nowrap;
  backdrop-filter: blur(8px);
  pointer-events: all;
}

#game-hint a {
  color: #ff9999;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  opacity: 1;
  border-bottom: 1px dotted rgba(255,150,150,0.5);
}

#game-hint a:hover { color: #fff; border-color: #fff; }

/* ── IFRAME ───────────────────────────────────────────────────────────────── */

#game-frame {
  width: 100%;
  height: min(75vh, 900px);
  min-height: 420px;
  border: none;
  display: none;
  background: #000;
}

#game-frame:fullscreen,
#game-frame:-webkit-full-screen,
#game-frame:-moz-full-screen {
  width: 100vw;
  height: 100vh;
}

/* ── FOOTER ───────────────────────────────────────────────────────────────── */

footer {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ── TABLET ───────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #game-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  #hero { padding: 50px 20px 28px; }
  #game-frame, #loading-msg { height: 70vh; min-height: 350px; }
}

/* ── MOBILE ───────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  #hero                     { padding: 40px 15px 28px; }
  #hero h1                  { font-size: clamp(2rem, 9vw, 3rem); }
  #launcher-top             { flex-direction: column; align-items: stretch; }
  #gcount                   { text-align: center; }
  #game-grid                { grid-template-columns: repeat(2, 1fr); }
  #game-frame, #loading-msg { height: 65vh; min-height: 300px; }
  .naa                      { gap: 12px; }
  a                         { font-size: 11px; }
  #fbar                     { flex-wrap: wrap; gap: 4px; }
  #cat-bar                  { gap: 4px; }
  .cat-btn                  { font-size: 10px; padding: 4px 9px; }
}
