/* ==========================================================================
   Aydin Valiyev — Games
   Theme tokens are swapped per game via [data-game] on <html>.
   ========================================================================== */

:root {
  --font-display: "Sora", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-theme: 900ms;

  /* defaults (overridden per game) */
  --accent: #ffd400;
  --accent-2: #ff2d2d;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, .68);
  --fg-faint: rgba(255, 255, 255, .42);
  --surface: rgba(255, 255, 255, .06);
  --surface-strong: rgba(255, 255, 255, .12);
  --line: rgba(255, 255, 255, .14);
  --shadow: 0 30px 80px rgba(0, 0, 0, .55);
  --badge-bg: #ffffff;
  --badge-fg: #0b0b0b;
  --badge-ghost-fg: #ffffff;
  --phone-frame: #141414;
}

/* ---- LightDrop: pitch black, red shards, a single warm light --------- */
html[data-game="lightdrop"] {
  --accent: #ffd400;
  --accent-2: #ff2d2d;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, .7);
  --fg-faint: rgba(255, 255, 255, .42);
  --surface: rgba(255, 255, 255, .06);
  --surface-strong: rgba(255, 255, 255, .12);
  --line: rgba(255, 255, 255, .14);
  --shadow: 0 30px 80px rgba(0, 0, 0, .7);
  --badge-bg: #ffffff;
  --badge-fg: #0b0b0b;
  --badge-ghost-fg: #ffffff;
  --phone-frame: #1a1a1a;
}

/* ---- Echo Pattern: cream, pastel tiles, calm ------------------------- */
html[data-game="echo"] {
  --accent: #e9007f;
  --accent-2: #1f9a3a;
  --fg: #3b2d2f;
  --fg-muted: rgba(59, 45, 47, .72);
  --fg-faint: rgba(59, 45, 47, .48);
  --surface: rgba(255, 255, 255, .55);
  --surface-strong: rgba(255, 255, 255, .85);
  --line: rgba(59, 45, 47, .12);
  --shadow: 0 30px 70px rgba(80, 60, 40, .22);
  --badge-bg: #3b2d2f;
  --badge-fg: #fff8ee;
  --badge-ghost-fg: #3b2d2f;
  --phone-frame: #efe9d6;
}

/* ---- Treadly: deep purple to magenta, playful tiles ------------------ */
html[data-game="treadly"] {
  --accent: #ffc233;
  --accent-2: #3fd76a;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, .78);
  --fg-faint: rgba(255, 255, 255, .5);
  --surface: rgba(255, 255, 255, .1);
  --surface-strong: rgba(255, 255, 255, .18);
  --line: rgba(255, 255, 255, .2);
  --shadow: 0 30px 80px rgba(40, 10, 70, .55);
  --badge-bg: #ffffff;
  --badge-fg: #3a1f6e;
  --badge-ghost-fg: #ffffff;
  --phone-frame: #2a1a4a;
}

/* ---- Base ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--fg);
  background: #000;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: color var(--t-theme) var(--ease);
}

a { color: inherit; }

img { display: block; max-width: 100%; }

button { font: inherit; }

/* ---- Background ----------------------------------------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--t-theme) var(--ease);
}

.bg-layer.is-active { opacity: 1; }

#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, transparent 50%, rgba(0, 0, 0, .35) 100%);
  opacity: 0;
  transition: opacity var(--t-theme) var(--ease);
}

html[data-game="lightdrop"] .bg-vignette { opacity: .9; }
html[data-game="treadly"] .bg-vignette { opacity: .3; }

/* ---- Header --------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 48px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 24px var(--accent);
  transition: background var(--t-theme) var(--ease), box-shadow var(--t-theme) var(--ease);
}

.site-nav {
  display: flex;
  gap: 4px;
}

.site-nav a {
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  color: var(--fg-muted);
  padding: 8px 12px;
  border-radius: 999px;
  transition: color .2s, background .2s;
}

.site-nav a:hover { color: var(--fg); background: var(--surface); }

/* ---- Layout --------------------------------------------------------- */
main {
  position: relative;
  z-index: 1;
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
}

.hero {
  padding: clamp(8px, 2vw, 24px) 0 clamp(48px, 7vw, 96px);
}

.eyebrow {
  margin: 0 0 18px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-align: center;
}

/* ---- Switcher ------------------------------------------------------- */
.switcher {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 auto clamp(28px, 5vw, 56px);
  padding: 6px;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background var(--t-theme) var(--ease), border-color var(--t-theme) var(--ease);
}

.switch-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: -.01em;
  transition: color .25s, background .25s, transform .25s var(--ease);
}

.switch-btn img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

.switch-btn:hover { color: var(--fg); background: var(--surface); }

.switch-btn.is-active {
  color: var(--badge-fg);
  background: var(--badge-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

.switch-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Showcase ------------------------------------------------------- */
.showcase {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.showcase-info {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .45s var(--ease), transform .55s var(--ease);
}

.showcase.is-leaving .showcase-info {
  opacity: 0;
  transform: translateY(14px);
  transition-duration: .25s;
}

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

.game-icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
  flex: none;
}

.game-genre {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.game-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 4.2vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -.03em;
}

.game-title em {
  display: block;
  font-style: normal;
  color: var(--fg-muted);
  font-weight: 600;
  font-size: .62em;
  margin-top: 2px;
}

.game-tagline {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  font-weight: 500;
  line-height: 1.4;
}

.game-desc {
  margin: 0 0 20px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--fg-muted);
  max-width: 54ch;
}

.game-features {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-features li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
}

.game-features li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

/* ---- Store badges --------------------------------------------------- */
.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  padding: 8px 20px 8px 14px;
  border-radius: 14px;
  text-decoration: none;
  background: var(--badge-bg);
  color: var(--badge-fg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background var(--t-theme) var(--ease), color var(--t-theme) var(--ease);
}

.store-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .3);
}

.store-badge svg { width: 26px; height: 26px; flex: none; }

.store-badge .badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.store-badge .badge-small {
  font-size: .66rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .75;
}

.store-badge .badge-big {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.store-badge.is-soon {
  background: transparent;
  color: var(--badge-ghost-fg);
  border: 1px dashed var(--line);
  box-shadow: none;
  opacity: .7;
  cursor: default;
}

.store-badge.is-soon:hover { transform: none; }

/* ---- Pager ---------------------------------------------------------- */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: clamp(28px, 4vw, 48px);
}

.pager-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition: background .2s, transform .2s var(--ease);
}

.pager-btn:hover { background: var(--surface-strong); transform: scale(1.06); }

.pager-count {
  font-family: var(--font-display);
  font-size: .85rem;
  font-weight: 600;
  color: var(--fg-faint);
  letter-spacing: .06em;
  min-width: 42px;
  text-align: center;
}

/* ---- Screenshots ---------------------------------------------------- */
.showcase-shots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: center;
  perspective: 1400px;
  padding: 24px 0;
}

.phone:nth-child(4) { display: none; }

.phone {
  position: relative;
  border-radius: 28px;
  padding: 8px;
  background: var(--phone-frame);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform .7s var(--ease), opacity .5s var(--ease), background var(--t-theme) var(--ease), box-shadow var(--t-theme) var(--ease);
  aspect-ratio: 9 / 17;
  overflow: hidden;
}

.phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  background: #000;
}

.phone:nth-child(1) { transform: translateY(26px) rotate(-3deg); }
.phone:nth-child(2) { transform: translateY(-18px) scale(1.04); z-index: 1; }
.phone:nth-child(3) { transform: translateY(26px) rotate(3deg); }

.showcase.is-leaving .phone {
  opacity: 0;
  transform: translateY(30px) scale(.96);
  transition-duration: .25s;
}

.showcase-shots.is-entering .phone {
  animation: phoneIn .75s var(--ease) both;
}

.showcase-shots.is-entering .phone:nth-child(2) { animation-delay: .07s; }
.showcase-shots.is-entering .phone:nth-child(3) { animation-delay: .14s; }
.showcase-shots.is-entering .phone:nth-child(4) { animation-delay: .21s; }

@keyframes phoneIn {
  from { opacity: 0; transform: translateY(40px) scale(.94); }
}

/* ---- About ---------------------------------------------------------- */
.about {
  padding: 0 0 clamp(56px, 8vw, 110px);
}

.about-card {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background var(--t-theme) var(--ease), border-color var(--t-theme) var(--ease);
}

.about-card h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: -.02em;
}

.about-card p {
  margin: 0 0 12px;
  line-height: 1.7;
  color: var(--fg-muted);
}

.about-card p:last-child { margin-bottom: 0; }

.about-card a { color: var(--fg); }

/* ---- Footer --------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 28px clamp(16px, 4vw, 48px) 36px;
  border-top: 1px solid var(--line);
  text-align: center;
  transition: border-color var(--t-theme) var(--ease);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
  margin-bottom: 10px;
}

.footer-links a {
  font-size: .88rem;
  color: var(--fg-muted);
  text-decoration: none;
}

.footer-links a:hover { color: var(--fg); text-decoration: underline; }

.copyright {
  margin: 0;
  font-size: .8rem;
  color: var(--fg-faint);
}

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 900px) {
  .showcase {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .showcase-shots {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .phone:nth-child(4) { display: block; transform: translateY(-18px) rotate(-2deg); }
  .phone { border-radius: 18px; padding: 5px; }
  .phone img { border-radius: 13px; }
}

@media (max-width: 640px) {
  .site-header { padding: 16px; }
  .brand { font-size: .95rem; white-space: nowrap; }
  .site-nav a { padding: 8px 8px; font-size: .84rem; }

  .switcher {
    width: 100%;
    border-radius: 20px;
    padding: 6px;
    gap: 4px;
  }

  .switch-btn {
    flex: 1 1 0;
    justify-content: center;
    padding: 8px 6px;
    font-size: .8rem;
  }

  .switch-btn .switch-label { display: none; }
  .switch-btn img { width: 36px; height: 36px; }

  .game-head { gap: 14px; }
  .game-icon { width: 68px; height: 68px; border-radius: 18px; }

  .showcase-shots {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 24px 0 16px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: none;
  }

  .showcase-shots::-webkit-scrollbar { display: none; }

  .phone {
    flex: 0 0 62%;
    scroll-snap-align: center;
  }

  .phone:nth-child(n) { transform: none; display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   Legal pages (privacy, terms)
   ========================================================================== */
html[data-game="legal"] {
  --accent: #7c9cff;
  --accent-2: #7c9cff;
  --fg: #eef1f7;
  --fg-muted: rgba(238, 241, 247, .72);
  --fg-faint: rgba(238, 241, 247, .46);
  --surface: rgba(255, 255, 255, .05);
  --surface-strong: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .12);
  --shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.legal-body { background: #0d1117; }

.legal-bg {
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(124, 156, 255, .18) 0%, transparent 60%),
    radial-gradient(50% 40% at 90% 10%, rgba(216, 79, 166, .12) 0%, transparent 60%),
    linear-gradient(180deg, #0f1420 0%, #0d1117 60%, #0b0e14 100%);
}

.legal {
  position: relative;
  z-index: 1;
  width: min(1080px, 100% - 32px);
  margin: 0 auto;
  padding: 8px 0 clamp(48px, 7vw, 96px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: color .2s, background .2s, transform .2s var(--ease);
}

.back-link:hover { color: var(--fg); background: var(--surface-strong); transform: translateX(-2px); }

.legal-head {
  margin: clamp(28px, 5vw, 56px) 0 clamp(24px, 4vw, 40px);
}

.legal-head .eyebrow { text-align: left; margin-bottom: 10px; }

.legal-head h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -.03em;
  line-height: 1.05;
}

.legal-meta {
  margin: 0;
  color: var(--fg-faint);
  font-size: .92rem;
}

.legal-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

.legal-toc {
  position: sticky;
  top: 24px;
}

.toc-title {
  margin: 0 0 10px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.legal-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

.legal-toc a {
  display: block;
  padding: 7px 0 7px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: .88rem;
  line-height: 1.35;
  transition: color .2s, border-color .2s;
}

.legal-toc a:hover { color: var(--fg); }
.legal-toc a.is-active { color: var(--fg); border-left-color: var(--accent); }

.legal-card {
  padding: clamp(22px, 4vw, 44px);
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.legal-card section { scroll-margin-top: 24px; }
.legal-card section + section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.legal-card h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.legal-card p {
  margin: 0 0 12px;
  line-height: 1.7;
  color: var(--fg-muted);
}

.legal-card p:last-child { margin-bottom: 0; }

.legal-card strong { color: var(--fg); font-weight: 600; }

.legal-card ul {
  margin: 0 0 14px;
  padding-left: 0;
  list-style: none;
}

.legal-card li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 7px;
  line-height: 1.6;
  color: var(--fg-muted);
}

.legal-card li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: .68em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.legal-card a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
}

.legal-card a:hover { text-decoration-color: var(--accent); }

.legal-footer-nav {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

@media (max-width: 820px) {
  .legal-layout { grid-template-columns: 1fr; }

  .legal-toc {
    position: static;
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
  }

  .legal-toc ol { border-left: 0; columns: 2; column-gap: 20px; }
  .legal-toc a { padding: 5px 0; border-left: 0; margin-left: 0; break-inside: avoid; }
  .legal-toc a.is-active { border-left: 0; }
}

@media (max-width: 480px) {
  .legal-toc ol { columns: 1; }
}
