:root {
  --bg: #0b0d14;
  --bg-2: #121522;
  --card: #161a29;
  --card-hi: #1c2134;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef0f7;
  --muted: #8b91a8;
  --brand: #6c8cff;
  --brand-2: #b07cff;
  --radius: 20px;
  --max: 1160px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(108, 140, 255, 0.18), transparent 60%),
    radial-gradient(700px 450px at 95% 5%, rgba(176, 124, 255, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px max(24px, calc((100% - var(--max)) / 2));
  background: rgba(11, 13, 20, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: 0.06em; }
.site-header nav { display: flex; gap: 6px; flex-wrap: wrap; }
.site-header nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.site-header nav a:hover { color: var(--text); background: var(--line); }
.site-header nav a[aria-current="page"] { color: var(--text); }
.site-header nav a { position: relative; z-index: 1; }
.site-header nav a[aria-current="page"]:hover { background: transparent; }
/* Active pill that glides between links (positioned by js/router.js) */
.nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 999px;
  background: rgba(108, 140, 255, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(.2,.8,.2,1), width 0.45s cubic-bezier(.2,.8,.2,1), opacity 0.2s;
}

/* ---------- Hero ---------- */
main { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; overflow-x: clip; }

/* Scroll reveal (classes added by js/router.js) */
.page .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s cubic-bezier(.2,.8,.2,1), transform 0.7s cubic-bezier(.2,.8,.2,1), border-color 0.25s; }
.page .reveal.is-visible { opacity: 1; transform: none; }

.hero { padding: 88px 0 56px; text-align: center; }
.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.hero h1 { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.08; font-weight: 800; letter-spacing: -0.02em; }
.grad {
  background: linear-gradient(90deg, var(--brand), var(--brand-2), #ff6fb5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { max-width: 560px; margin: 22px auto 0; color: var(--muted); font-size: 1.1rem; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 40px; }
.chip {
  --accent: var(--brand);
  font: inherit;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.chip b { margin-left: 4px; font-weight: 700; opacity: 0.6; }
.chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.chip.is-active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.chip.is-active b { opacity: 0.75; }

/* ---------- Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding-bottom: 96px;
}

.member {
  --accent: var(--brand);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  animation: rise 0.45s ease both;
}
.member:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--accent) 60%, transparent);
}

.avatar {
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 50% 65%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 68%),
    var(--card-hi);
  border-bottom: 1px solid var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.member:hover .avatar img { transform: scale(1.05); }

.info { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.name { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.handle { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }

.role {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.role-icon { font-size: 0.78rem; }
.rank { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.bio { margin-top: 12px; font-size: 0.95rem; color: #c3c7d8; flex: 1; }

.links { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link svg { width: 16px; height: 16px; flex-shrink: 0; fill: currentColor; }
.link.roblox:hover { background: #fff; color: #111; }
.link.discord:hover { background: #5865f2; border-color: #5865f2; }
.link.is-empty { cursor: default; color: var(--muted); }
.link.is-empty:hover { background: var(--bg-2); border-color: var(--line); }

/* ---------- Owner (featured) ---------- */
.owner-slot:empty { display: none; }
.owner-slot { margin-bottom: 20px; }
.member.is-owner {
  flex-direction: row;
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    var(--card);
}
.member.is-owner .avatar { width: 340px; flex-shrink: 0; border-bottom: 0; border-right: 1px solid var(--line); }
.member.is-owner .info { justify-content: center; padding: 36px 44px; }
.member.is-owner .name { font-size: 2.4rem; }
.member.is-owner .bio { flex: 0; font-size: 1.05rem; max-width: 480px; }
.crown {
  align-self: flex-start;
  margin-bottom: 10px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
}

/* ---------- Verified badge ---------- */
.name { display: flex; align-items: center; gap: 8px; }
.verified { display: inline-flex; flex-shrink: 0; }
.verified svg { width: 0.8em; height: 0.8em; }

/* ---------- Main studio card (team page, above the roster) ---------- */
.studio-main { margin-bottom: 48px; }

/* ---------- Sub-studios ---------- */
.substudios { padding: 24px 0 96px; border-top: 1px solid var(--line); }
.section-head { text-align: center; padding: 64px 0 36px; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.01em; }
.substudio-list { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }

.substudio {
  --accent: var(--brand);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 32px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.25s, transform 0.25s;
}
.substudio:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.substudio-top { display: flex; align-items: center; gap: 28px; }

.substudio-logo {
  width: 112px;
  height: 112px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--card-hi));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.substudio-logo img { width: 100%; height: 100%; object-fit: cover; }
.substudio-info { min-width: 0; flex: 1; }
.substudio-tag {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.substudio .bio { flex: 0; }
.link.play { background: var(--accent); border-color: var(--accent); color: #0b0d14; font-weight: 600; }
.link.play:hover { filter: brightness(1.1); }

.stats { display: flex; gap: 12px; flex-shrink: 0; }
.stat {
  min-width: 110px;
  padding: 16px 18px;
  text-align: center;
  border-radius: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.stat b { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--accent); }
.stat span { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.people {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.person {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 18px 12px 16px;
  border-radius: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.person:hover { transform: translateY(-3px); background: var(--card-hi); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.person img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--card-hi);
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--line);
}
.person-text { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; }
.person-name { display: flex; align-items: center; gap: 5px; font-weight: 600; }
.person-handle { max-width: 100%; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-role {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--line);
}
.person.is-owner .person-role { color: #0b0d14; background: #f5c542; }
.person.is-owner img { box-shadow: 0 0 0 2px #f5c542; }

/* ---------- Games page ---------- */
.summary { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.summary .stat {
  position: relative;
  overflow: hidden;
  min-width: 150px;
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1), border-color 0.3s, box-shadow 0.3s;
}
.summary .stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.summary .stat:hover {
  transform: translateY(-3px);
  border-color: rgba(108, 140, 255, 0.45);
  box-shadow: 0 14px 30px -16px rgba(108, 140, 255, 0.6);
}
/* first load: tiles rise in one after another */
.summary.is-intro .stat { animation: statIn 0.6s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(150ms + var(--i) * 90ms); }
@keyframes statIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
/* page switch: a soft light sweep across each tile */
.summary .stat::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(160, 180, 255, 0.16) 50%, transparent 65%);
  transform: translateX(-110%);
  pointer-events: none;
}
.summary.is-sweep .stat::after { animation: statSweep 0.9s cubic-bezier(.4,0,.2,1) both; animation-delay: calc(var(--i) * 80ms); }
@keyframes statSweep { to { transform: translateX(110%); } }

.games { display: flex; flex-direction: column; gap: 32px; padding-bottom: 32px; }

.game {
  --accent: var(--brand);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  padding: 32px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 300px at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--card);
  scroll-margin-top: 90px;
}
.game.is-flipped { background:
    radial-gradient(600px 300px at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--card); }
.game.is-flipped .gallery { order: 2; }

/* Gallery */
.gallery { min-width: 0; outline: none; }
.gallery:focus-visible .gallery-main { outline: 2px solid var(--accent); outline-offset: 3px; }
.gallery-main {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
  box-shadow: 0 24px 60px -24px color-mix(in srgb, var(--accent) 55%, transparent);
}
.gallery-track { display: flex; height: 100%; transition: transform 0.45s cubic-bezier(.2,.8,.2,1); }
.gallery-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; }
.gallery-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}
.gallery-nav svg { width: 20px; height: 20px; }
.gallery-nav.prev { left: 12px; }
.gallery-nav.next { right: 12px; }
.gallery-main:hover .gallery-nav, .gallery-nav:focus-visible { opacity: 1; }
.gallery-nav:hover { background: var(--accent); }
.gallery-thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.thumb {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
}
.thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.thumb:hover { opacity: 0.85; }
.thumb.is-active { opacity: 1; border-color: var(--accent); }

/* Info */
.game-info { min-width: 0; }
.game-head { display: flex; align-items: center; gap: 18px; }
.game-icon {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.game-title { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
.version {
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.game-studio { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 0.95rem; }
.game-studio b { color: var(--text); font-weight: 600; }
.game-studio:hover b { text-decoration: underline; }
.studio-note {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--line);
}
.genres { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.genres span { font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); }
.game-tagline { margin-top: 16px; font-size: 1.1rem; color: #d5d8e6; }
.features { list-style: none; display: grid; gap: 8px; margin-top: 16px; }
.features li { display: flex; align-items: flex-start; gap: 10px; color: #c3c7d8; }
.features svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 3px; color: var(--accent); }

.game-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 24px; }
.gstat {
  position: relative;
  padding: 12px 10px;
  text-align: center;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gstat b { display: block; font-size: 1.35rem; font-weight: 800; line-height: 1.15; }
.gstat span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.meter { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--v); background: var(--accent); }
.game-dates { margin-top: 12px; font-size: 0.85rem; color: var(--muted); }

.game-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  border-radius: 12px;
  font-weight: 700;
  color: #0b0d14;
  background: var(--accent, var(--brand));
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent, var(--brand)) 80%, transparent);
  transition: transform 0.2s, filter 0.2s;
}
.btn-play svg { width: 18px; height: 18px; fill: currentColor; }
.btn-play:hover { transform: translateY(-2px); filter: brightness(1.08); }
.game-actions .link { padding: 13px 18px; border-radius: 12px; }

.cta { text-align: center; padding: 72px 0 96px; }
.cta h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; }
.cta > p { color: var(--muted); margin: 10px auto 26px; max-width: 480px; }
.cta .btn-play { --accent: var(--brand); }
.cta-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  border-radius: 12px;
  font-weight: 700;
  color: #fff;
  background: #5865f2;
  box-shadow: 0 10px 30px -10px rgba(88, 101, 242, 0.8);
  transition: transform 0.2s, filter 0.2s;
}
.btn-discord svg { width: 18px; height: 18px; fill: currentColor; }
.btn-discord:hover { transform: translateY(-2px); filter: brightness(1.08); }
.cta .fineprint { margin-top: 26px; font-size: 0.8rem; }

@media (max-width: 960px) {
  .game, .game.is-flipped { grid-template-columns: 1fr; gap: 28px; padding: 22px; }
  .game.is-flipped .gallery { order: 0; }
  .gallery-nav { opacity: 1; }
}
@media (max-width: 560px) {
  .game-stats { grid-template-columns: repeat(2, 1fr); }
  .game-head { align-items: flex-start; }
  .game-icon { width: 64px; height: 64px; border-radius: 16px; }
  .summary .stat { min-width: 0; flex: 1 1 40%; }
}

/* ---------- Footer & toast ---------- */
.site-footer {
  padding: 28px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  border-radius: 12px;
  background: #5865f2;
  color: #fff;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 10px 30px -10px rgba(88, 101, 242, 0.7);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .site-header { flex-direction: column; gap: 12px; padding-block: 14px; }
  .hero { padding: 56px 0 36px; }
  .member.is-owner { flex-direction: column; }
  .member.is-owner .avatar { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .member.is-owner .info { padding: 22px; }
  .member.is-owner .name { font-size: 1.9rem; }
  .substudio { padding: 22px; }
  .substudio-top { flex-direction: column; text-align: center; }
  .substudio .links, .substudio .name { justify-content: center; }
  .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .people { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
