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

:root {
  --bg: #000000;
  --card: #0b0c10;
  --surface: #0f1116;
  --text: #f7f8fa;
  --muted: #98a2b3;
  --accent: #7cf4c4;
  --accent-2: #7dd3fc;
  --border: #1a1d28;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  --radius: 16px;
  --max-width: 100vw;
}

html {
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  background:
    radial-gradient(120% 120% at 20% 10%, rgba(124, 244, 196, 0.08), transparent 40%),
    radial-gradient(140% 140% at 80% 0%, rgba(125, 211, 252, 0.10), transparent 32%),
    var(--bg);
}

.site-header {
  width: 100vw;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 32px 16px;
}

.centered { text-align: center; }

h1 { margin: 0; font-size: 2.3rem; letter-spacing: 0.01em; }
.tagline { margin: 8px 0 18px; color: var(--muted); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(124, 244, 196, 0.55);
}
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: var(--muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pill-link {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,0.03);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.pill-link:hover { border-color: var(--accent); color: var(--accent); }
.pill-link.active { border-color: rgba(124, 244, 196, 0.65); box-shadow: 0 0 0 1px rgba(124, 244, 196, 0.25); }

.hero-search {
  width: min(520px, 100%);
  padding: 14px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 1rem;
  box-shadow: var(--shadow);
  outline: none;
}
.hero-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 244, 196, 0.22); }
.filter-btn {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }

main {
  width: 100vw;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 36px 64px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.catalog-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: 0.01em; cursor: pointer; }

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  border: 1px solid rgba(125,211,252,0.3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  aspect-ratio: 16 / 9;
  position: relative;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.1);
  transition: transform 180ms ease, filter 180ms ease;
}

.card-content {
  position: absolute;
  inset: auto 0 0 0;
  padding: 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.7) 60%);
}

.card h3 { margin: 0; font-size: 1rem; }
.card p { margin: 4px 0 8px; color: var(--muted); font-size: 0.9rem; }

.card a {
  display: inline-block;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.card:hover img { transform: scale(1.03); filter: saturate(1.25); }

.card a:hover { background: rgba(125, 211, 252, 0.16); color: var(--accent); }

.card-link { text-decoration: none; color: inherit; }
.card.mini {
  aspect-ratio: auto;
  min-height: 140px;
  padding: 14px;
}
.card .card-body h3 { margin: 0 0 6px; }
.card .card-body p { margin: 0; color: var(--muted); }

.game-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.player-wrapper {
  background: #0b0d14;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
}

.player-wrapper .ruffle-player {
  width: 100%;
  height: 100%;
  display: block;
}

.controls {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.95rem;
}

#status { color: var(--muted); margin: 0; }

.back-link { color: var(--accent); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.grid-ghost p { margin: 0; }

.dropdown {
  position: relative;
}
.dropdown button {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, color 0.2s ease;
}
.dropdown button:hover { border-color: var(--accent); color: var(--accent); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
  min-width: 180px;
  z-index: 5;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.dropdown-menu a {
  display: block;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease;
}
.dropdown-menu a:hover { background: rgba(255,255,255,0.05); color: var(--accent); }
.dropdown-menu a:hover { transform: scale(1.02); }
.dropdown.open .dropdown-menu { display: block; opacity: 1; transform: translateY(0); }
.dropdown.open button { transform: scale(1.03); border-color: var(--accent); color: var(--accent); }

.player-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.player-frame {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b0d14;
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 80vh;
}
.player-frame iframe, .player-frame .ruffle-player {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.player-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.player-actions a {
  text-decoration: none;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.player-actions a:hover { border-color: var(--accent); color: var(--accent); }

.proxy-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 60px;
}
.proxy-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.proxy-row {
  display: flex;
  gap: 10px;
}
.proxy-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.proxy-row button {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .player-wrapper { aspect-ratio: 4 / 3; }
  .nav { flex-direction: column; align-items: flex-start; }
  .proxy-row { flex-direction: column; }
  .nav-row { flex-direction: column; align-items: flex-start; }
}
