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

:root {
  --bg: #06060a;
  --s: #0e0e14;
  --b: #1c1c28;
  --t: #f0f0f0;
  --m: #555;
  --a: #e8ff47;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Syne", sans-serif;
  background: var(--bg);
  color: var(--t);
  min-height: 100vh;
  overflow-x: hidden;
}


#app {
  display: block;
}

/* BG grid */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .014) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ══ NAV ════════════════════════════════════════════════════ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2.5rem;
  background: rgba(6, 6, 10, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--b);
}

.nav-logo {
  font-family: "DM Mono", monospace;
  font-size: 0.75rem;
  color: var(--a);
  text-decoration: none;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--a);
  animation: blink 1.4s steps(1) infinite;
}

.nav-search {
  display: flex;
  align-items: center;
  background: var(--s);
  border: 1px solid var(--b);
  border-radius: 5px;
  padding: 0.36rem 0.85rem;
  gap: 0.45rem;
}

.nav-search input {
  background: none;
  border: none;
  outline: none;
  font-family: "DM Mono", monospace;
  font-size: 0.7rem;
  color: var(--t);
  width: 155px;
}

.nav-search input::placeholder {
  color: #2e2e2e;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: "DM Mono", monospace;
  font-size: 0.66rem;
  color: var(--m);
}

.nav-right b {
  color: var(--a);
}

.nav-logout {
  font-size: 0.6rem;
  color: #2e2e2e;
  background: none;
  border: 1px solid #1a1a1a;
  border-radius: 3px;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
  font-family: "DM Mono", monospace;
  letter-spacing: 0.06em;
  transition: color 0.15s, border-color 0.15s;
}

.nav-logout:hover {
  color: #555;
  border-color: #333;
}

.btn-apps-back {
  font-family: "DM Mono", monospace;
  font-size: .62rem;
  letter-spacing: .08em;
  color: #bb88ff;
  background: rgba(187, 136, 255, .08);
  border: 1px solid rgba(187, 136, 255, .25);
  border-radius: 3px;
  padding: .28rem .75rem;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}

.btn-apps-back:hover {
  background: rgba(187, 136, 255, .18);
  border-color: rgba(187, 136, 255, .5);
}


/* ══ HERO ═══════════════════════════════════════════════════ */
.hero {
  padding: 7.5rem 2.5rem 2rem;
  max-width: 1240px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: "DM Mono", monospace;
  font-size: 0.6rem;
  color: var(--m);
  letter-spacing: 0.22em;
  margin-bottom: 0.8rem;
}

.hero-h1 {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: .9;
  margin-bottom: 1.8rem;
}

.hero-h1 em {
  color: var(--a);
  font-style: normal;
}

.hero-h1 .ghost {
  -webkit-text-stroke: 1px #1e1e1e;
  color: transparent;
}

/* ══ FILTER CATS ════════════════════════════════════════════ */
.cats {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cat {
  font-family: "DM Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: .1em;
  padding: 0.26rem 0.75rem;
  border-radius: 2px;
  border: 1px solid var(--b);
  background: none;
  color: #383838;
  cursor: pointer;
  transition: all .15s;
}

.cat:hover {
  color: var(--t);
  border-color: #333;
}

.cat.on {
  color: var(--a);
  border-color: rgba(232, 255, 71, .38);
  background: rgba(232, 255, 71, .04);
}

/* ══ GRID ════════════════════════════════════════════════════ */
.sec {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 2.5rem 5rem;
  position: relative;
  z-index: 1;
}

.sec-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.2rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--b);
}

.sec-bar h2 {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--m);
}

.sec-bar small {
  font-family: "DM Mono", monospace;
  font-size: .58rem;
  color: #2a2a2a;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

/* ══ GAME CARD ══════════════════════════════════════════════ */
.card {
  background: var(--s);
  border: 1px solid var(--b);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, .1);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .75);
}

.card:hover .overlay {
  opacity: 1;
}

.thumb {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .52);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .18s;
  z-index: 3;
}

.play-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #000;
  font-weight: bold;
  box-shadow: 0 0 24px currentColor;
}

/* ══ GAME LOGOS ═════════════════════════════════════════════ */
.game-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 58px;
  margin-bottom: .55rem;
  position: relative;
}

.game-logo svg {
  width: auto;
  height: 100%;
  max-width: 100%;
  display: block;
}

.info {
  padding: .6rem .95rem .85rem;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tag {
  font-family: "DM Mono", monospace;
  font-size: .55rem;
  letter-spacing: .1em;
  color: #383838;
}

.stars {
  font-size: .58rem;
  color: #febc2e;
  letter-spacing: -1px;
}

.rec {
  font-family: "DM Mono", monospace;
  font-size: .55rem;
  margin-top: .3rem;
}

/* ══ GAME MODAL ═════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, .9);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal.on {
  opacity: 1;
  pointer-events: all;
}

.mbar {
  width: 100%;
  max-width: 700px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 0;
}

.mname {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.mclose {
  font-family: "DM Mono", monospace;
  font-size: .68rem;
  color: var(--m);
  background: var(--s);
  border: 1px solid var(--b);
  border-radius: 4px;
  padding: .36rem .8rem;
  cursor: pointer;
  transition: all .15s;
}

.mclose:hover {
  color: var(--t);
  border-color: #333;
}

.gwrap {
  width: 100%;
  max-width: 700px;
  border: 1px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  position: relative;
  box-shadow: 0 0 0 1px #222,
    0 0 18px 2px var(--game-glow, #e8ff47),
    inset 0 0 12px rgba(0, 0, 0, .5);
  transition: box-shadow .3s;
}

.gwrap canvas {
  display: block;
  width: 100%;
}

.ctrls {
  width: 100%;
  max-width: 700px;
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  padding: .5rem 0;
}

.ctrl {
  font-family: "DM Mono", monospace;
  font-size: .56rem;
  color: #3a3a3a;
  background: var(--s);
  border: 1px solid var(--b);
  border-radius: 2px;
  padding: .16rem .5rem;
}


/* ══ PAUSE OVERLAY & SCREEN SHAKE ═════════════════════════ */
.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  border-radius: 8px;
}

.pause-overlay.on {
  opacity: 1;
  pointer-events: all;
}

.pause-overlay h2 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--game-glow, #e8ff47);
  letter-spacing: -0.02em;
  text-shadow: 0 0 16px var(--game-glow, rgba(232, 255, 71, 0.5));
  margin-bottom: 0.5rem;
}

.pause-overlay p {
  font-family: "DM Mono", monospace;
  font-size: 0.8rem;
  color: #ccc;
  margin-bottom: 1.5rem;
}

.pause-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  font-family: "DM Mono", monospace;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pause-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
}

@keyframes shake {

  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translate(-3px, -2px) rotate(-1deg);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translate(3px, 2px) rotate(1deg);
  }
}

.shake {
  animation: shake 0.35s cubic-bezier(.36, .07, .19, .97) both;
}


/* ══ MOBILE D-PAD ═══════════════════════════════════════════ */
.dpad-overlay {
  display: none;
  width: 100%;
  max-width: 700px;
  padding: .6rem 0 .4rem;
  user-select: none;
}

@media(hover:none), (pointer:coarse) {
  .dpad-overlay {
    display: block;
  }
}

.dpad-row {
  display: flex;
  justify-content: center;
  gap: .4rem;
  margin: .2rem 0;
}

.dpad-btn {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--t);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, transform .08s;
  touch-action: manipulation;
}

.dpad-btn:active,
.dpad-btn.pressed {
  background: rgba(255, 255, 255, .18);
  transform: scale(.93);
}

.dpad-btn.action {
  background: rgba(232, 255, 71, .12);
  border-color: rgba(232, 255, 71, .35);
  color: var(--a);
  font-size: .65rem;
  width: auto;
  padding: 0 1rem;
  letter-spacing: .06em;
  font-family: "DM Mono", monospace;
}

.dpad-spacer {
  width: 52px;
  height: 52px;
}

.dpad-actions {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: .5rem;
}

/* ══ TOAST ══════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 600;
  background: var(--s);
  border: 1px solid var(--b);
  border-radius: 5px;
  padding: .6rem 1rem;
  font-family: "DM Mono", monospace;
  font-size: .68rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  transform: translateY(16px);
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
}

.toast.on {
  transform: none;
  opacity: 1;
}

.toast b {
  color: var(--a);
}

@media(max-width:640px) {
  nav {
    padding: .8rem 1.1rem;
  }

  .nav-search {
    display: none;
  }

  .hero {
    padding: 5.5rem 1.1rem 1.5rem;
  }

  .sec {
    padding: 0 1.1rem 3rem;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
    gap: .65rem;
  }
}