@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&display=swap");

/* Night arcade (default) */
:root {
  --bg: #0a0618;
  --glow-pink: rgba(255, 62, 165, 0.22);
  --glow-cyan: rgba(53, 242, 255, 0.16);
  --surface: rgba(22, 13, 50, 0.8);
  --surface-solid: #160d32;
  --surface-strong: #241652;
  --text: #f5f2ff;
  --muted: #b3abd6;
  --accent: #35f2ff;
  --accent-2: #ff3ea5;
  --on-accent: #0a0618;
  --cta: #ffe14d;
  --cta-ink: #0a0618;
  --cta-edge: #b8960a;
  --line: rgba(53, 242, 255, 0.2);
  --line-strong: rgba(255, 62, 165, 0.55);
  --grid: rgba(255, 62, 165, 0.16);
  --scanline: rgba(255, 255, 255, 0.03);
  --title-grad: linear-gradient(90deg, #ffe14d, #ff3ea5 45%, #35f2ff, #ffe14d);
  --title-glow: drop-shadow(0 0 22px rgba(255, 62, 165, 0.38));
  --text-glow: 0 0 18px rgba(53, 242, 255, 0.35);
  --glow: 0 0 28px rgba(53, 242, 255, 0.18);
  --chunk: rgba(0, 0, 0, 0.6);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  --display: Orbitron, "Arial Black", ui-sans-serif, system-ui, sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  color-scheme: dark;
}

/* Sunset arcade (light mode) */
body.light {
  --bg: #f4efff;
  --glow-pink: rgba(255, 62, 165, 0.16);
  --glow-cyan: rgba(53, 200, 255, 0.2);
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-strong: #ebe3ff;
  --text: #1b0f3f;
  --muted: #5d5490;
  --accent: #0a86a8;
  --accent-2: #d6237f;
  --on-accent: #ffffff;
  --cta: #ffe14d;
  --cta-ink: #1b0f3f;
  --cta-edge: #c9a300;
  --line: rgba(27, 15, 63, 0.14);
  --line-strong: rgba(214, 35, 127, 0.45);
  --grid: rgba(123, 60, 255, 0.12);
  --title-grad: linear-gradient(90deg, #d6237f, #7a3cff 50%, #0a86a8);
  --title-glow: none;
  --text-glow: none;
  --glow: 0 0 0 transparent;
  --chunk: rgba(27, 15, 63, 0.22);
  --shadow: 0 10px 0 rgba(27, 15, 63, 0.12), 0 18px 40px rgba(93, 84, 144, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--body);
  line-height: 1.6;
  background:
    radial-gradient(circle at 12% -4%, var(--glow-pink), transparent 34rem),
    radial-gradient(circle at 92% 6%, var(--glow-cyan), transparent 30rem),
    var(--bg);
}

/* Hub pages get a retro perspective floor and faint scanlines. */
body.hub::before {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  z-index: -1;
  height: 52vh;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(520px) rotateX(62deg);
  transform-origin: bottom center;
  -webkit-mask-image: linear-gradient(transparent, #000 75%);
  mask-image: linear-gradient(transparent, #000 75%);
}

body.hub::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, var(--scanline) 0 1px, transparent 1px 3px);
}

body.light.hub::after { display: none; }

a { color: inherit; }
img { max-width: 100%; }
code { color: var(--accent); font-size: 0.92em; }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.1;
  text-wrap: balance;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffe14d, #ff3ea5);
  color: #0a0618;
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 900;
  box-shadow: 0 0 0 2px var(--bg), 0 0 20px rgba(255, 62, 165, 0.5);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  position: relative;
  padding: 0.35rem 0;
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-links a::after {
  content: "";
  position: absolute;
  inset: auto 0 -4px 0;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transform: scaleX(0);
  transition: transform 200ms ease;
}

.nav-links a:hover,
.nav-links a.active { color: var(--text); }

.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

/* Buttons: chunky, pressable, with a bottom "edge" */
.theme-toggle,
.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 4px 0 var(--chunk);
  cursor: pointer;
  font: inherit;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 160ms ease;
}

.theme-toggle { padding: 0.6rem 0.9rem; }

.theme-toggle:hover,
.button:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--chunk), 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

.theme-toggle:active,
.button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--chunk);
}

.theme-toggle:focus-visible,
.button:focus-visible,
.game-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.button.primary {
  border-color: transparent;
  background: var(--cta);
  color: var(--cta-ink);
  box-shadow: 0 5px 0 var(--cta-edge);
}

.button.primary:hover {
  box-shadow: 0 7px 0 var(--cta-edge), 0 0 26px rgba(255, 225, 77, 0.45);
}

.button.primary:active {
  box-shadow: 0 1px 0 var(--cta-edge);
}

/* Shared type */
.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  color: var(--accent-2);
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}

.kicker {
  color: var(--accent);
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  background: var(--title-grad);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: var(--title-glow);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  animation: sheen 9s linear infinite;
}

/* Home */
.hero {
  min-height: 78vh;
  display: grid;
  align-items: center;
  padding: 5rem 0 3.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.hero h1 { font-size: clamp(3rem, 8.5vw, 6.2rem); }

.hero p {
  max-width: 640px;
  margin: 1.3rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

.feature-panel {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow), var(--glow);
}

.feature-tile {
  position: relative;
  padding: 1rem 1rem 1rem 1.3rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.feature-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.feature-tile strong {
  display: block;
  color: var(--accent);
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.feature-tile h2,
.feature-tile h3 {
  margin: 0.35rem 0;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.feature-tile p { margin: 0; color: var(--muted); }

section { padding: 4.25rem 0; }

.section-heading {
  max-width: 720px;
  margin-bottom: 1.75rem;
}

.section-heading h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-shadow: var(--text-glow);
}

.section-heading p { margin: 0; color: var(--muted); }

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.info-card {
  min-height: 176px;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 0 var(--chunk);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.info-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 0 var(--chunk), var(--glow);
}

.info-card span {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.info-card h3 {
  margin: 0.8rem 0 0.5rem;
  font-size: 1.08rem;
  text-transform: uppercase;
}

.info-card p { margin: 0; color: var(--muted); }

.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent-2) 26%, var(--surface)), color-mix(in srgb, var(--accent) 12%, var(--surface)));
  box-shadow: var(--shadow);
}

.cta-band h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  text-transform: uppercase;
  text-shadow: var(--text-glow);
}

.cta-band p { margin: 0.45rem 0 0; color: var(--muted); }

footer {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Games catalog */
.catalog { padding: 3.5rem 0 4.5rem; }

.catalog section { padding: 0; }

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.page-heading h1 { font-size: clamp(2.8rem, 8vw, 5.4rem); }

.page-heading p {
  max-width: 580px;
  margin: 0.9rem 0 0;
  color: var(--muted);
}

.library-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
  padding: 0.85rem 1rem 0.85rem 1.2rem;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.library-strip::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
  background: var(--cta);
  box-shadow: 0 0 14px var(--cta);
}

.library-strip p { margin: 0; color: var(--muted); }

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.game-card {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 6px 0 var(--chunk), var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 11px 0 var(--chunk), 0 0 34px color-mix(in srgb, var(--accent) 36%, transparent);
}

.game-card.is-featured { border-color: color-mix(in srgb, var(--cta) 55%, transparent); }

.game-card.is-featured:hover,
.game-card.is-featured:focus-visible {
  border-color: var(--cta);
  box-shadow: 0 11px 0 var(--chunk), 0 0 34px rgba(255, 225, 77, 0.3);
}

/* Floating play badge in the top-right of each card */
.game-card::after {
  content: "\25B6";
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding-left: 3px;
  border-radius: 50%;
  background: var(--cta);
  color: var(--cta-ink);
  font-size: 0.85rem;
  box-shadow: 0 0 0 3px var(--surface), 0 0 20px rgba(255, 225, 77, 0.55);
  transition: transform 180ms ease;
}

.game-card:hover::after,
.game-card:focus-visible::after { transform: scale(1.12); }

.game-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
  transition: transform 300ms ease;
}

.game-card:hover .game-thumb { transform: scale(1.04); }

.game-body { padding: 1.1rem 1.1rem 1.2rem; }

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.pill {
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pill.pill-featured {
  background: var(--cta);
  color: var(--cta-ink);
}

.game-card h2 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.game-card p {
  margin: 0.55rem 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.game-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent);
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-action::after {
  content: "\2192";
  transition: transform 160ms ease;
}

.game-card:hover .game-action::after { transform: translateX(4px); }

.load-message {
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}

/* Player pages: full-screen game with a slide-out menu */
body.player {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.game-frame {
  width: 100vw;
  height: 100vh;
  display: block;
  border: 0;
  background: #000;
}

.edge-zone {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 6;
  width: 24px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 7;
  width: min(300px, calc(100vw - 2rem));
  padding: 1.1rem;
  border-right: 2px solid var(--line-strong);
  background: linear-gradient(180deg, var(--surface-solid), var(--bg));
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.45), 0 0 30px color-mix(in srgb, var(--accent-2) 18%, transparent);
  transform: translateX(calc(-100% + 18px));
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.edge-zone:hover + .sidebar,
.sidebar:hover,
.sidebar:focus-within {
  transform: translateX(0);
}

.handle {
  position: absolute;
  top: 50%;
  right: -44px;
  display: grid;
  width: 44px;
  height: 112px;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: var(--cta);
  color: var(--cta-ink);
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  box-shadow: 4px 0 18px rgba(255, 225, 77, 0.35);
}

.sidebar h1 {
  margin: 0.4rem 0 0.6rem;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  text-shadow: var(--text-glow);
  text-transform: uppercase;
}

.sidebar p { margin: 0; color: var(--muted); }

.menu {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.menu .button { width: 100%; }

.hint {
  margin-top: 1.2rem;
  padding: 0.85rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
  color: var(--muted);
  font-size: 0.9rem;
}

.hint strong { color: var(--text); }

.error {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  padding: 1rem;
  text-align: center;
  background: var(--bg);
}

.error-card {
  width: min(560px, 100%);
  padding: 1.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.error-card h1 {
  margin: 0 0 0.6rem;
  font-size: 1.5rem;
  text-transform: uppercase;
}

.error-card p { color: var(--muted); }

.blocked-note {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 4;
  max-width: 360px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
  color: var(--muted);
  font-size: 0.9rem;
  box-shadow: var(--shadow), var(--glow);
}

.blocked-note.dismissed { display: none; }

.blocked-note button {
  float: right;
  width: 28px;
  height: 28px;
  margin: -0.25rem -0.25rem 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.blocked-note a {
  color: var(--accent);
  font-weight: 800;
}

/* Motion */
@keyframes blink {
  to { visibility: hidden; }
}

@keyframes sheen {
  to { background-position: 200% center; }
}

/* Responsive */
@media (max-width: 920px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.9rem 0;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links {
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .nav-links a { white-space: nowrap; }
  .hero-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .cta-band { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 700px) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .games-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
