:root {
  color-scheme: dark;
  --bg: #0b0b20;
  --card: #171735;
  --ink: #fff;
  --muted: #aeb1d0;
  --purple: #8b5cf6;
  --purple-dark: #6742d6;
  --pink: #ff5fa2;
  --cyan: #5ee7f2;
  --yellow: #ffd84d;
  --line: #ffffff18;
  --glass: #ffffff0b;
  --focus: #80eff7;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-rounded, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.aurora {
  position: fixed;
  z-index: -1;
  inset: -30vmax;
  pointer-events: none;
  background:
    radial-gradient(circle at 38% 16%, #7c3aed33, transparent 26%),
    radial-gradient(circle at 72% 7%, #ec489933, transparent 22%),
    radial-gradient(circle at 52% 60%, #0891b21b, transparent 25%);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 72px;
  padding: 0 max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #0b0b20d9;
  backdrop-filter: blur(18px);
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  font-weight: 950;
  letter-spacing: .08em;
}
.logo span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--purple), var(--pink));
  box-shadow: 0 0 30px #8b5cf666;
}
.profile-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s;
}
.profile-button span:first-child {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff12;
}

main {
  width: min(1180px, 100%);
  margin: auto;
  padding: 0 18px max(70px, env(safe-area-inset-bottom));
}
.hero {
  min-height: 370px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  align-items: center;
  gap: 30px;
  padding: 52px 4px 30px;
}
.eyebrow {
  margin: 0;
  color: var(--cyan) !important;
  font-size: 12px !important;
  font-weight: 900;
  letter-spacing: .18em;
}
.hero h1 {
  margin: 12px 0 22px;
  font-size: clamp(49px, 9vw, 92px);
  line-height: .88;
  letter-spacing: -.065em;
}
.hero h1 em {
  background: linear-gradient(90deg, var(--purple), var(--pink), var(--yellow));
  background-clip: text;
  color: transparent;
  font-style: normal;
}
.hero p { color: var(--muted); font-size: 18px; }
.hero-orbit {
  position: relative;
  width: min(350px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border: 1px solid #ffffff18;
  border-radius: 50%;
  box-shadow: inset 0 0 80px #7c3aed22;
}
.hero-orbit::before, .hero-orbit::after {
  content: "";
  position: absolute;
  inset: 16%;
  border: 1px solid #ffffff12;
  border-radius: 50%;
  transform: rotate(30deg);
}
.hero-orbit::after {
  inset: 34%;
  background: radial-gradient(circle, #8b5cf688, transparent 67%);
  box-shadow: 0 0 80px #8b5cf655;
}
.hero-orbit span {
  position: absolute;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid #fff3;
  border-radius: 22px;
  background: #171735e8;
  box-shadow: 0 14px 35px #0008;
  font-size: 35px;
}
.hero-orbit span:nth-child(1) { top: 1%; left: 40%; }
.hero-orbit span:nth-child(2) { top: 40%; right: 1%; }
.hero-orbit span:nth-child(3) { bottom: 1%; left: 40%; }
.hero-orbit span:nth-child(4) { top: 40%; left: 1%; }

.controls {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.search {
  min-width: min(360px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff0c;
  transition: border-color .18s, background .18s;
}
.search:focus-within { border-color: #8b5cf699; background: #ffffff11; }
.search span { color: var(--muted); font-size: 28px; }
.search input {
  width: 100%;
  height: 50px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
}
.search input::placeholder { color: #8f93b6; }
.filters {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 3px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff08;
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
  transition: .18s;
}
.chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple), #7047dd);
  color: #fff;
  box-shadow: 0 7px 22px #7c3aed38;
}

.section-title {
  margin: 28px 0 15px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
}
.section-title h2 { margin: 0; font-size: 25px; }
.section-title span { color: var(--muted); }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(300px, 82vw);
  gap: 14px;
  overflow-x: auto;
  padding: 0 2px 14px;
  scroll-snap-type: x mandatory;
  scrollbar-color: #ffffff25 transparent;
}

.game-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, #1d1d40, var(--card));
  box-shadow: 0 18px 50px #0004;
  scroll-snap-align: start;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.cover {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #292958;
}
.cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 35%;
  background: linear-gradient(transparent, #0d0d2799);
  pointer-events: none;
}
.cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .35s ease;
}
.status {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 12px;
  padding: 6px 9px;
  border: 1px solid #ffffff22;
  border-radius: 999px;
  background: #09091ddd;
  color: #f2c3ff;
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 950;
}
.favorite {
  position: absolute;
  z-index: 2;
  top: 11px;
  right: 11px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #fff4;
  border-radius: 50%;
  background: #09091ddd;
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform .18s, color .18s, background .18s;
}
.favorite.active { background: #37132edd; color: var(--pink); }
.favorite:active { transform: scale(.9); }
.card-body {
  min-height: 248px;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 18px;
}
.card-body h3 {
  min-height: 2.35em;
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.16;
}
.card-body p {
  min-height: 4.4em;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  color: var(--muted);
  line-height: 1.47;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.tags {
  min-height: 27px;
  margin: 14px 0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}
.tag {
  padding: 5px 9px;
  border: 1px solid #ffffff0b;
  border-radius: 999px;
  background: #ffffff0b;
  color: #cdd0ed;
  font-size: 11px;
  font-weight: 850;
}
.actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}
.primary, .secondary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s, filter .18s, background .18s, border-color .18s;
}
.primary {
  flex: 1;
  background: linear-gradient(135deg, #955fff, var(--purple-dark));
  box-shadow: 0 9px 24px #7c3aed3d;
}
.secondary {
  background: #ffffff0d;
  border-color: #ffffff0b;
}
.primary:active, .secondary:active { transform: translateY(2px); }
.empty { color: var(--muted); }

.idea-note {
  margin-top: 34px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, #7c3aed18, #0891b218);
}
.idea-note > span { font-size: 31px; }
.idea-note strong { font-size: 16px; }
.idea-note p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }

.modal {
  width: min(680px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: auto;
  border: 1px solid #ffffff26;
  border-radius: 28px;
  background: #15152f;
  color: #fff;
  box-shadow: 0 30px 100px #000b;
}
.modal::backdrop { background: #050512cc; backdrop-filter: blur(8px); }
.close {
  position: sticky;
  z-index: 3;
  top: 12px;
  right: 12px;
  float: right;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #fff3;
  border-radius: 50%;
  background: #111126e8;
  color: #fff;
  font-size: 25px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.detail-cover {
  width: 100%;
  aspect-ratio: 16 / 8;
  display: block;
  object-fit: cover;
}
.detail-body { padding: 24px; }
.detail-body h2 {
  margin: 8px 0 14px;
  font-size: clamp(32px, 8vw, 52px);
  line-height: 1;
  letter-spacing: -.035em;
}
.detail-body > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.detail-meta {
  margin: 20px 0 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.detail-meta div, .detail-controls {
  padding: 12px;
  border: 1px solid #ffffff0a;
  border-radius: 15px;
  background: #ffffff09;
}
.detail-meta small, .detail-controls small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}
.detail-controls { margin-bottom: 6px; line-height: 1.45; }
.detail-actions {
  position: sticky;
  bottom: 0;
  margin-top: 6px;
  padding: 16px 0 2px;
  display: flex;
  gap: 9px;
  background: linear-gradient(transparent, #15152f 24%);
}
.detail-actions .favorite-detail { flex: 0 0 48px; padding: 0; font-size: 22px; }
.detail-actions .favorite-detail.active { background: #37132e; color: var(--pink); }

.profile-modal form { padding: 34px; }
.big-avatar { font-size: 62px; }
.profile-modal h2 { margin: 7px 0; font-size: 36px; }
.muted { color: var(--muted); }
.profile-modal label:not(.switch) {
  margin: 24px 0;
  display: grid;
  gap: 7px;
  font-weight: 900;
}
.profile-modal input:not([type]) {
  height: 52px;
  padding: 0 14px;
  border: 1px solid #fff2;
  border-radius: 15px;
  background: #ffffff0b;
  color: #fff;
}
.switch {
  margin: 0 0 24px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #ffffff12;
  border-radius: 15px;
  background: #ffffff08;
  cursor: pointer;
}
.switch input { width: 20px; height: 20px; accent-color: var(--purple); }
.profile-modal .primary { width: 100%; }
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  max-width: calc(100% - 30px);
  padding: 12px 18px;
  border-radius: 999px;
  background: #fff;
  color: #15152f;
  box-shadow: 0 12px 35px #0006;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 30px);
  transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (hover: hover) {
  .game-card:hover { transform: translateY(-5px); border-color: #ffffff38; box-shadow: 0 24px 65px #0006; }
  .game-card:hover .cover img { transform: scale(1.035); }
  .profile-button:hover, .secondary:hover { border-color: #ffffff2e; background: #ffffff14; }
  .primary:hover { filter: brightness(1.1); }
  .favorite:hover { transform: scale(1.06); }
}

@media (max-width: 700px) {
  .hero { min-height: 320px; display: block; padding-top: 42px; }
  .hero-orbit { display: none; }
  .hero h1 { font-size: clamp(49px, 15vw, 59px); }
  .hero p { max-width: 310px; font-size: 15px; }
  .controls { align-items: stretch; flex-direction: column; }
  .filters { margin-inline: -18px; padding-inline: 18px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .game-card { border-radius: 19px; }
  .card-body { min-height: 184px; padding: 13px; }
  .card-body h3 { min-height: 2.4em; margin-bottom: 6px; font-size: 17px; }
  .card-body p { display: none; }
  .tags { min-height: 48px; margin: 6px 0 10px; }
  .tag { padding: 4px 7px; font-size: 10px; }
  .tag:nth-child(n + 3) { display: none; }
  .actions .secondary { display: none; }
  .actions .primary { width: 100%; min-height: 46px; }
  .detail-meta { grid-template-columns: 1fr 1fr; }
  .detail-actions { flex-wrap: wrap; }
  .detail-actions .primary { flex-basis: calc(100% - 57px); }
  .detail-actions [data-share], .detail-actions [data-install] { flex: 1; }
}

@media (max-width: 430px) {
  main { padding-inline: 15px; }
  .topbar { padding-inline: 14px; }
  .profile-button { max-width: 55%; }
  #profileName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .filters { margin-inline: -15px; padding-inline: 15px; }
  .grid { gap: 10px; }
  .favorite { top: 8px; right: 8px; width: 40px; height: 40px; }
  .card-body { min-height: 180px; padding: 12px; }
  .primary { padding-inline: 10px; }
  .idea-note { align-items: flex-start; }
  .detail-body, .profile-modal form { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
