/* ==========================================================
   PIXEL ARCADE — hub page
   ========================================================== */
body.hub {
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(to bottom, #07030f 0%, #1a0838 55%, #3b0b4f 100%) fixed;
}

/* ---------- Background: stars + synthwave horizon ---------- */
#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.horizon {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 45vh;
  z-index: 0;
  pointer-events: none;
}
.sun {
  position: absolute;
  left: 50%;
  bottom: 62%;
  width: 34vh;
  height: 34vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--yellow) 0%, var(--orange) 45%, var(--pink) 90%);
  box-shadow: 0 0 80px rgba(255, 46, 136, 0.6);
  -webkit-mask: repeating-linear-gradient(to bottom, #000 0 9%, transparent 9% 12%);
          mask: repeating-linear-gradient(to bottom, #000 0 9%, transparent 9% 12%);
  animation: sun-pulse 4s ease-in-out infinite;
  opacity: 0.85;
}
@keyframes sun-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
.floor {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 62%;
  background:
    linear-gradient(to bottom, #1a0838 0%, transparent 30%),
    repeating-linear-gradient(to right, rgba(255, 46, 136, 0.7) 0 2px, transparent 2px 60px),
    repeating-linear-gradient(to bottom, rgba(255, 46, 136, 0.7) 0 2px, transparent 2px 60px);
  background-color: #12052a;
  transform: perspective(300px) rotateX(60deg);
  transform-origin: top center;
  animation: floor-move 1.2s linear infinite;
}
@keyframes floor-move {
  from { background-position: 0 0, 0 0, 0 0; }
  to   { background-position: 0 0, 0 0, 0 60px; }
}

/* ---------- Layout ---------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 120px;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  margin-bottom: 36px;
}
.logo {
  position: relative;
  display: inline-block;
  margin: 10px 0 18px;
  font-family: var(--pixel);
  font-size: clamp(28px, 6.5vw, 68px);
  line-height: 1.15;
  color: var(--yellow);
  text-shadow:
    4px 4px 0 var(--pink),
    8px 8px 0 var(--purple),
    0 0 30px rgba(255, 230, 0, 0.5);
  animation: logo-float 3s ease-in-out infinite;
}
.logo .ch {
  display: inline-block;
  animation: wave 2.4s ease-in-out infinite;
}
@keyframes wave {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-12px); }
}
@keyframes logo-float {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
}
/* glitch layers */
.logo::before,
.logo::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.logo.glitch::before {
  color: var(--cyan);
  text-shadow: none;
  opacity: 0.8;
  clip-path: inset(10% 0 55% 0);
  transform: translate(-6px, 0);
}
.logo.glitch::after {
  color: var(--pink);
  text-shadow: none;
  opacity: 0.8;
  clip-path: inset(60% 0 8% 0);
  transform: translate(6px, 0);
}
.logo.glitch .ch { color: transparent; }

.tagline {
  font-size: 26px;
  color: var(--cyan);
  min-height: 32px;
  margin: 0 0 12px;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}
.caret { animation: blink 0.8s steps(2, start) infinite; }
.coin {
  font-family: var(--pixel);
  font-size: 12px;
  color: var(--pink);
  margin: 0;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  padding: 16px;
  background: rgba(21, 10, 46, 0.75);
  border: 3px solid var(--purple);
  box-shadow: 0 0 20px rgba(157, 77, 255, 0.35);
  backdrop-filter: blur(4px);
}
.filters, .toggles { display: flex; gap: 12px; flex-wrap: wrap; }
.btn.small { font-size: 9px; padding: 8px 10px; }
.search {
  flex: 1;
  min-width: 160px;
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--green);
  background: #05020c;
  border: 3px solid var(--green);
  padding: 10px 12px;
  outline: none;
  caret-color: var(--green);
}
.search::placeholder { color: #2c7d1a; }
.search:focus { box-shadow: 0 0 14px rgba(57, 255, 20, 0.5); }

/* ---------- Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
}
.card {
  --c: var(--cyan);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 4px solid var(--c);
  box-shadow: 6px 6px 0 #000, 0 0 0 rgba(0,0,0,0);
  color: inherit;
  text-decoration: none;
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.2s;
  animation: card-in 0.6s cubic-bezier(.2,1.5,.4,1) both;
  animation-delay: calc(var(--i, 0) * 90ms);
  cursor: pointer;
  outline: none;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(40px) scale(0.9); }
  to   { opacity: 1; transform: none; }
}
.card:hover, .card:focus-visible {
  box-shadow: 10px 10px 0 #000, 0 0 30px var(--c);
}
.card .label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--c);
  color: var(--bg);
  font-family: var(--pixel);
  font-size: 9px;
}
.card .screen {
  position: relative;
  margin: 10px;
  border: 3px solid #000;
  background: #000;
  overflow: hidden;
}
.card canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  image-rendering: pixelated;
}
.card .screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,0.3) 2px 3px);
  pointer-events: none;
}
.card .body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h2 {
  margin: 0;
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--c);
  text-shadow: 2px 2px 0 #000;
}
.card p { margin: 0; color: #cfc8ea; font-size: 19px; line-height: 1.05; flex: 1; }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card .tag {
  font-family: var(--pixel);
  font-size: 8px;
  padding: 4px 6px;
  border: 2px solid var(--dim);
  color: var(--dim);
}
.card .foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--yellow);
}
.card .play {
  color: var(--bg);
  background: var(--c);
  padding: 6px 8px;
}
.card:hover .play { animation: blink 0.5s steps(2, start) infinite; }

.card.horror {
  background: #0a0507;
  border-color: #5a0d0d;
  animation-name: card-in, horror-flicker;
  animation-duration: 0.6s, 4s;
  animation-iteration-count: 1, infinite;
}
.card.horror .label { background: #5a0d0d; color: #ff9a9a; }
.card.horror h2 { color: #e8e8e8; text-shadow: 2px 0 0 #f00, -2px 0 0 #0ff; letter-spacing: 2px; }
.card.horror p { color: #9a8a8a; }
.card.horror .tag { border-color: #5a0d0d; color: #a33; }
.card.horror .foot { color: #a33; }
.card.horror .play { background: #8a0000; color: #fff; }
.card.horror:hover, .card.horror:focus-visible {
  border-color: #ff2a2a;
  box-shadow: 10px 10px 0 #000, 0 0 40px rgba(255, 0, 0, 0.6);
}
.card.horror:hover h2 { animation: horror-shake 0.15s infinite; }
@keyframes horror-flicker {
  0%, 91%, 94%, 100% { filter: none; }
  92% { filter: brightness(0.3); }
  93% { filter: brightness(1.6) hue-rotate(-20deg); }
}
@keyframes horror-shake {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-1px, 1px); }
  66% { transform: translate(1px, -1px); }
}

.card.soon {
  --c: var(--dim);
  cursor: default;
  border-style: dashed;
}
.card.soon canvas { opacity: 0.6; }

.empty {
  text-align: center;
  font-family: var(--pixel);
  font-size: 12px;
  color: var(--pink);
  margin-top: 30px;
}
.hidden { display: none !important; }

/* ---------- Ticker ---------- */
.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  overflow: hidden;
  background: #000;
  border-top: 3px solid var(--yellow);
  padding: 8px 0;
  white-space: nowrap;
}
.ticker-track {
  display: inline-block;
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--yellow);
  padding-left: 100%;
  animation: ticker 28s linear infinite;
}
.ticker-track span { margin-right: 60px; }
.ticker-track em { color: var(--cyan); font-style: normal; }
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ---------- Boot screen ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: #000;
  color: var(--green);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  font-size: 24px;
  transition: opacity 0.5s, transform 0.5s;
}
.boot pre {
  font-family: var(--mono);
  margin: 0 0 20px;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
  white-space: pre-wrap;
}
.boot-bar {
  width: min(480px, 80vw);
  height: 22px;
  border: 3px solid var(--green);
  padding: 3px;
}
#boot-fill { height: 100%; width: 0; background: var(--green); }
.boot-skip { font-family: var(--pixel); font-size: 10px; color: #2c7d1a; margin-top: 20px; }
.boot.off {
  opacity: 0;
  transform: scaleY(0.005);
  pointer-events: none;
}

/* ---------- Page wipe transition ---------- */
.wipe {
  position: fixed;
  inset: 0;
  z-index: 8500;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.wipe i {
  background: var(--bg);
  transform: scale(0);
  transition: transform 0.25s ease-in;
}
.wipe.on i { transform: scale(1.05); }

/* ---------- Konami rainbow mode ---------- */
body.rainbow { animation: hue 3s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 600px) {
  .toolbar { justify-content: center; }
  body { font-size: 18px; }
}
