:root {
  --bg: #080808;
  --surface: #111111;
  --line: #242424;
  --text: #f4f4f4;
  --muted: #969696;
  --page: min(1120px, calc(100% - 40px));
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  inset: -12%;
  background:
    radial-gradient(ellipse 52% 34% at 50% 6%, rgba(255, 255, 255, 0.075), transparent 72%),
    radial-gradient(ellipse 38% 28% at 12% 60%, rgba(255, 255, 255, 0.025), transparent 74%),
    radial-gradient(ellipse 42% 30% at 88% 82%, rgba(255, 255, 255, 0.02), transparent 76%),
    linear-gradient(180deg, #0b0b0c 0%, #080808 48%, #0a0a0b 100%);
  filter: blur(36px);
  transform: translateZ(0);
}

body::after {
  z-index: -1;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.14) 0.45px, transparent 0.55px),
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-position: 0 0, center top, center top;
  background-size: 4px 4px, 48px 48px, 48px 48px;
  opacity: 0.72;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 14px;
  background: white;
  color: black;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

header,
footer,
.games,
.paths {
  width: var(--page);
  margin: 0 auto;
}

header {
  position: sticky;
  z-index: 50;
  top: 0;
  isolation: isolate;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

header.header-hidden {
  transform: translateY(-100%);
}

header::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  background: rgba(12, 12, 14, 0.86);
  backdrop-filter: blur(16px) saturate(1.1);
  transform: translateX(-50%);
}

header::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100vw;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(-50%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}

header .brand {
  color: var(--text);
}

.brand img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

nav {
  display: flex;
  gap: 4px;
}

header nav {
  gap: 24px;
}

nav a,
footer a,
.text-link {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

nav a:hover,
footer a:hover,
.text-link:hover {
  color: white;
}

header nav a {
  position: relative;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  color: #d1d1d5;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: color 150ms ease;
}

header nav a::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 6px;
  left: 2px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

header nav a:hover,
header nav a:focus-visible {
  color: var(--text);
}

header nav a:hover::after,
header nav a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

.hero {
  position: relative;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  width: min(100%, 900px);
  margin-bottom: 16px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1;
  letter-spacing: -0.06em;
  font-weight: 600;
}

.rotating-word {
  position: relative;
  display: inline-block;
  overflow: hidden;
  color: var(--text);
  font-family: inherit;
  font-size: 0.96em;
  font-weight: 600;
  letter-spacing: -0.06em;
  text-align: center;
  text-decoration-line: underline;
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.12em;
  white-space: nowrap;
  transition: width 360ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease, transform 220ms ease;
}

.hero-title-line,
.title-ending {
  display: flex;
  align-items: baseline;
  justify-content: center;
}

.hero-title-line {
  gap: 0.26em;
  white-space: nowrap;
}

.title-ending {
  gap: 0.16em;
}

.rotating-word.is-changing {
  opacity: 0;
  transform: translateY(0.16em);
}

.hero p {
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 18px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 8px;
  background: #f2f2f2;
  color: #090909;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: filter 150ms ease, transform 150ms ease;
}

.button:hover {
  filter: brightness(0.88);
  transform: translateY(-2px);
}

.games {
  padding: 96px 0;
}

.games-page {
  min-height: calc(100svh - 172px);
  padding-top: 72px;
}

.games-page h1 {
  margin: 0 0 12px;
  font-size: clamp(42px, 7vw, 72px);
}

h2 {
  margin-bottom: 28px;
  font-size: 32px;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.games > h2 {
  margin-bottom: 10px;
}

.games-note {
  max-width: 620px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.games-note summary {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b8b8be;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color 150ms ease;
}

.games-note summary::-webkit-details-marker {
  display: none;
}

.games-note summary::after {
  content: "+";
  color: #77777f;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  transition: transform 180ms ease;
}

.games-note summary:hover {
  color: var(--text);
}

.games-note[open] summary::after {
  transform: rotate(45deg);
}

.games-note p {
  margin: 10px 0 0;
}

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

.game {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease;
}

.game:hover {
  border-color: #444;
  transform: translateY(-3px);
}

.game img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  display: block;
  object-fit: contain;
  background: #0d0d0d;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.game span {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  font-weight: 500;
}

.featured-game {
  position: relative;
  aspect-ratio: 1;
}

.featured-game::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  pointer-events: none;
}

.featured-game img {
  height: 100%;
}

.featured-game span {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: auto;
  padding: 28px 16px 16px;
  border: 0;
  background: transparent;
  color: white;
}

.featured-game:hover img {
  transform: scale(1.025);
}

.more-row {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 36px;
}

.secondary-button {
  min-width: 144px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border: 1px solid #f4f4f4;
  border-radius: 999px;
  background: #f4f4f4;
  color: #080808;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.secondary-button:hover {
  background: transparent;
  color: white;
  transform: translateY(-2px);
}

.secondary-button span {
  font-size: 16px;
}

.paths {
  padding: 56px 0 96px;
}

.paths h2 {
  margin-bottom: 28px;
}

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

.path {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  border: 1px solid #303034;
  border-radius: 12px;
  background: rgba(18, 18, 20, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.path:hover {
  border-color: #505055;
  background: rgba(22, 22, 24, 0.96);
  transform: translateY(-3px);
}

.path h3 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.path p {
  margin: 0;
  color: #c2c2c8;
  font-size: 15px;
  line-height: 1.7;
}

.contact {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 70px 20px;
  text-align: center;
}

.contact h2 {
  margin-bottom: 14px;
  font-size: clamp(36px, 6vw, 56px);
}

.contact p {
  margin-bottom: 28px;
  color: var(--muted);
}

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

.actions .text-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 1px solid #353535;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.actions .text-link:hover {
  border-color: #555;
  background: var(--surface);
  transform: translateY(-2px);
}

footer {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

footer div {
  display: flex;
  gap: 20px;
}

a:focus-visible {
  outline: 2px solid white;
  outline-offset: 4px;
}

.motion-item {
  opacity: 0;
  transform: translateY(24px) scale(0.985);
  transition: opacity 620ms ease, transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.motion-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.game.motion-item {
  transition: opacity 620ms ease, transform 620ms cubic-bezier(0.22, 1, 0.36, 1), border-color 150ms ease;
}

.game.motion-item.is-visible:hover {
  transform: translateY(-3px);
}

.path.motion-item {
  transition: opacity 620ms ease, transform 620ms cubic-bezier(0.22, 1, 0.36, 1), border-color 180ms ease, background 180ms ease;
}

.path.motion-item.is-visible:hover {
  transform: translateY(-3px);
}

.path-grid .motion-item:nth-child(2) {
  transition-delay: 70ms;
}

.path-grid .motion-item:nth-child(3) {
  transition-delay: 140ms;
}

.game-grid .motion-item:nth-child(2) {
  transition-delay: 70ms;
}

.game-grid .motion-item:nth-child(3) {
  transition-delay: 140ms;
}

.game-grid .motion-item:nth-child(4) {
  transition-delay: 210ms;
}

@media (max-width: 800px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .path-grid {
    grid-template-columns: 1fr;
  }

  .path {
    min-height: 190px;
  }
}

@media (max-width: 600px) {
  :root {
    --page: calc(100% - 28px);
  }

  header {
    height: 64px;
  }

  .brand {
    gap: 8px;
    font-size: 16px;
  }

  .brand img {
    width: 50px;
    height: 50px;
  }

  nav {
    gap: 16px;
  }

  nav a:last-child {
    display: none;
  }

  .hero {
    min-height: 510px;
    padding-right: 28px;
    padding-left: 28px;
  }

  .hero h1 {
    font-size: 44px;
    line-height: 1.05;
  }

  .rotating-word {
    text-align: center;
  }

  .hero-title-line {
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .games {
    padding: 70px 0;
  }

  .paths {
    padding: 24px 0 70px;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    width: min(280px, 100%);
    flex-direction: column;
  }

  .actions .button {
    width: 100%;
  }

  .actions .text-link {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }

  .motion-item {
    opacity: 1;
    transform: none;
  }
}
