@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --bg: #0b0b16;
  --panel: #141426;
  --panel2: #1b1b32;
  --text: #f4f2ff;
  --muted: #a3a1bc;
  --purple: #a78bfa;
  --cyan: #67e8f9;
  --line: #292943;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: radial-gradient(circle at 75% 0%, #28204b 0, transparent 34%), var(--bg);
  color: var(--text);
  font: 15px 'DM Sans', sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
  min-height: 76px;
  padding: 12px max(5vw, 22px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: #0b0b16e8;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(16px);
}

.brand {
  font: 700 22px 'Space Grotesk';
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark { color: var(--cyan); font-size: 30px; }

nav {
  display: flex;
  gap: 28px;
  color: var(--muted);
}

nav a:hover { color: white; }

.account {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

button, .link-button {
  border: 0;
  border-radius: 12px;
  padding: 11px 17px;
  font: 600 14px 'DM Sans';
  cursor: pointer;
}

button:disabled { opacity: .6; cursor: wait; }

.primary {
  background: linear-gradient(110deg, #8b5cf6, #6366f1);
  color: white;
}

.primary:hover { filter: brightness(1.13); }

.ghost {
  background: var(--panel2);
  color: white;
}

.link-button { display: inline-block; }

.hero {
  min-height: 460px;
  padding: 70px 9vw;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: 40px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan);
  font-weight: 700;
}

.hero h1 {
  font: 700 clamp(46px, 6vw, 76px)/1.02 'Space Grotesk';
  margin: 16px 0;
}

.hero h1 span { color: var(--purple); }

.hero-copy {
  color: var(--muted);
  max-width: 470px;
  line-height: 1.7;
  margin-bottom: 28px;
}

.hero-art {
  height: 300px;
  position: relative;
  display: grid;
  place-items: center;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}

.orb-a {
  width: 230px;
  height: 230px;
  background: linear-gradient(140deg, #7c3aed99, #22d3ee55);
  right: 10%;
  top: 4%;
}

.orb-b {
  width: 140px;
  height: 140px;
  background: #ec489955;
  left: 10%;
  bottom: 0;
}

.game-window {
  z-index: 1;
  width: 270px;
  height: 205px;
  border: 1px solid #a78bfa88;
  border-radius: 20px;
  background: linear-gradient(145deg, #29204b, #10182b);
  box-shadow: 0 25px 80px #0009;
  transform: rotate(-5deg);
  padding: 15px;
  text-align: center;
}

.window-dots { text-align: left; color: #a78bfa; font-size: 10px; }

.pixel {
  font: 700 38px 'Space Grotesk';
  letter-spacing: 5px;
  margin: 24px;
  color: #fff;
  text-shadow: 4px 4px #8b5cf6;
}

.game-window small { color: var(--cyan); letter-spacing: 3px; }

.section { padding: 55px 9vw; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 24px;
}

.section h2 {
  font: 600 34px 'Space Grotesk';
  margin: 5px 0;
}

.game-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

.section-head input,
label input,
label select {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px 15px;
  border-radius: 12px;
  color: white;
  min-width: 220px;
  font: inherit;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.game-card, .download-card, .post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.game-cover {
  height: 145px;
  display: grid;
  place-items: center;
  font-size: 48px;
  background: linear-gradient(135deg, #31205d, #123e56);
  overflow: hidden;
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card:nth-child(3n+2) .game-cover {
  background: linear-gradient(135deg, #4a2357, #263c6b);
}

.game-card:nth-child(3n) .game-cover {
  background: linear-gradient(135deg, #174b55, #39245e);
}

.game-info { padding: 17px; }
.game-info h3 { margin: 0 0 7px; }

.muted, .hint { color: var(--muted); }

.game-info p {
  color: var(--muted);
  font-size: 13px;
  min-height: 38px;
  line-height: 1.5;
}

.game-info button { width: 100%; margin-top: 8px; }

.download-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.download-card {
  padding: 19px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.download-card h3 { margin: 0 0 5px; }

.download-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.community {
  background: #111122;
  border-top: 1px solid var(--line);
}

#postForm {
  display: flex;
  gap: 12px;
  margin: 22px 0;
}

textarea {
  resize: vertical;
  min-height: 48px;
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: white;
  font: inherit;
}

.feed { display: grid; gap: 12px; }

.post { padding: 17px; }

.post strong { color: var(--purple); }

.post p {
  line-height: 1.6;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

footer {
  padding: 28px 9vw;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

dialog {
  background: var(--panel);
  color: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  width: min(440px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 25px 90px #0009;
}

dialog::backdrop { background: #000b; }

dialog h2 {
  font: 600 25px 'Space Grotesk';
  margin-top: 0;
}

dialog label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  margin: 18px 0;
}

dialog label input,
dialog label select {
  width: 100%;
  min-width: 0;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.dialog-heading h2 { margin-bottom: 12px; }

.icon-button {
  background: var(--panel2);
  color: white;
  padding: 8px 11px;
}

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  margin-top: 20px;
}

.full-button { width: 100%; margin-top: 10px; }

.signout-button { margin-top: 12px; }

.auth-switch {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.text-button {
  background: transparent;
  color: var(--cyan);
  padding: 5px;
}

.form-message {
  color: var(--cyan);
  font-size: 13px;
  line-height: 1.5;
  min-height: 18px;
}

.form-message.error { color: #fca5a5; }

.hint { font-size: 13px; }

.game-dialog { width: min(460px, 92vw); }

.memory-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.memory-card {
  font-size: 23px;
  padding: 15px 5px;
  min-height: 60px;
}

.runner-track {
  height: 16px;
  background: #292943;
  border-radius: 20px;
  position: relative;
  margin: 20px 0;
}

.runner-marker {
  position: absolute;
  top: 0;
  left: 10%;
  width: 10%;
  height: 100%;
  border-radius: 20px;
  background: var(--cyan);
}

@media(max-width: 760px) {
  .topbar {
    min-height: 68px;
    flex-wrap: wrap;
    padding: 14px 20px;
    gap: 12px;
  }

  nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
  }

  .account span { display: none; }

  .hero {
    grid-template-columns: 1fr;
    padding: 55px 7vw;
  }

  .hero-art { height: 230px; }
  .section { padding: 42px 7vw; }
  .game-grid { grid-template-columns: 1fr 1fr; }
  .download-list { grid-template-columns: 1fr; }
  footer { padding: 24px 7vw; gap: 12px; flex-wrap: wrap; }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .game-tools { flex-wrap: wrap; }
  .game-tools input { flex: 1; min-width: 0; }
}

@media(max-width: 460px) {
  .game-grid { grid-template-columns: 1fr; }

  #postForm { flex-direction: column; }

  .download-card {
    align-items: flex-start;
    flex-direction: column;
  }
}