:root {
  --bg: #0f1117;
  --surface: #171a22;
  --surface-raised: #1e222d;
  --text: #f7f3ea;
  --text-muted: #b7b2a6;
  --border: rgba(247, 243, 234, 0.14);
  --accent: #ffb81c;
  --accent-hover: #ffc94d;
  --accent-ink: #0f1117;
  --focus: #22d3ee;

  --font-display: "Space Grotesk", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  --font-body: "Noto Sans SC", "Space Grotesk", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;

  /* 3-size body typography discipline below hero */
  --text-heading: clamp(1.5rem, 2.4vw, 2rem);
  --text-body: 1rem;
  --text-sm: 0.875rem;

  --container: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.65;
  background-color: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  background-color: transparent;
  transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.site-header.is-scrolled {
  background-color: rgba(15, 17, 23, 0.92);
  border-bottom-color: var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.brand-mark {
  width: 0.75rem;
  height: 0.75rem;
  background-color: var(--accent);
  transform: skewX(-14deg);
}

.brand-tld {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
}

.site-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  opacity: 0.86;
  white-space: nowrap;
  transition: opacity 160ms var(--ease-out), color 160ms var(--ease-out);
}

.site-nav a:hover {
  opacity: 1;
  color: var(--accent);
}

/* Hero — full-bleed edge-to-edge stage from y = 0 */
.hero {
  position: relative;
  min-height: min(88dvh, 760px);
  display: flex;
  align-items: flex-end;
  padding-top: 6.5rem;
  padding-bottom: clamp(3rem, 7vw, 5.5rem);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 44%;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to top,
      var(--bg) 0%,
      rgba(15, 17, 23, 0.86) 36%,
      rgba(15, 17, 23, 0.28) 68%,
      rgba(15, 17, 23, 0.56) 100%
    ),
    linear-gradient(
      to right,
      rgba(15, 17, 23, 0.78) 0%,
      rgba(15, 17, 23, 0.24) 56%,
      rgba(15, 17, 23, 0.08) 100%
    );
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 6.2vw, 5.25rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--text);
  max-width: 16ch;
}

.nowrap {
  white-space: nowrap;
}

.hero-lead {
  margin: 0 0 2rem;
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--text);
  max-width: 44ch;
}

.hero-actions {
  display: flex;
  align-items: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0 1.75rem;
  border-radius: 0.375rem;
  background-color: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Sections */
.section {
  padding-block: clamp(4rem, 8vw, 6.5rem);
}

.section-alt {
  background-color: var(--surface);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 60ch;
  margin-bottom: 2rem;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: var(--text-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section-intro {
  margin: 0;
  font-size: var(--text-body);
  color: var(--text-muted);
  max-width: 58ch;
}

/* Segmented Gallery Control */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--surface);
  padding: 0.25rem;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.seg-tab {
  appearance: none;
  border: 0;
  border-radius: 0.3125rem;
  background-color: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.seg-tab:hover {
  color: var(--text);
}

.seg-tab.is-active {
  background-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.stage-frame {
  margin: 0;
}

.stage-viewport {
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: #090b10;
  aspect-ratio: 16 / 9;
}

.stage-viewport img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 180ms var(--ease-out);
}

.stage-viewport img.is-pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.stage-caption {
  margin-top: 1rem;
  font-size: var(--text-body);
  color: var(--text-muted);
  max-width: 65ch;
}

/* Controls & Gameplay Loop */
.controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: start;
}

.feature-list {
  margin: 2rem 0 0;
}

.feature-row {
  padding-block: 1.25rem;
  border-top: 1px solid var(--border);
}

.feature-row:last-child {
  border-bottom: 1px solid var(--border);
}

.feature-row dt {
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.feature-row dd {
  margin: 0;
  font-size: var(--text-body);
  color: var(--text-muted);
  max-width: 52ch;
}

.controls-sheet {
  border-top: 1px solid var(--border);
}

.key-table {
  width: 100%;
  border-collapse: collapse;
}

.key-table th,
.key-table td {
  text-align: left;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.key-table th {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
}

.key-table td:first-child {
  width: 44%;
  padding-right: 1rem;
  font-size: var(--text-sm);
  color: var(--text);
}

.key-table td:last-child {
  font-size: var(--text-body);
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  background-color: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.3;
}

/* Game Catalog */
.catalog-list {
  border-top: 1px solid var(--border);
}

.game-entry {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.25rem);
  align-items: center;
  padding-block: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
}

.game-thumb {
  display: block;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--surface);
  transition: transform 200ms var(--ease-out), border-color 200ms var(--ease-out);
}

.game-thumb:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.game-thumb img {
  width: 100%;
  aspect-ratio: 1232 / 706;
  object-fit: cover;
}

.game-meta h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: var(--text-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.game-desc {
  margin: 0 0 1rem;
  font-size: var(--text-body);
  color: var(--text-muted);
  max-width: 48ch;
}

.game-specs {
  margin: 0 0 1.75rem;
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
}

.catalog-note {
  padding-top: 1.5rem;
}

.catalog-note p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer-link {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  transition: opacity 160ms var(--ease-out);
}

.footer-link:hover {
  opacity: 0.85;
}

/* Responsive */
@media (max-width: 860px) {
  .controls-grid,
  .game-entry {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: min(82dvh, 640px);
  }
}

@media (max-width: 560px) {
  .hero-media img {
    object-position: 78% 42%;
  }

  .header-inner {
    height: 4rem;
  }

  .brand {
    font-size: 1.1875rem;
  }

  .site-nav {
    gap: 0.875rem;
  }

  .segmented {
    display: flex;
    width: 100%;
  }

  .seg-tab {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.5rem 0.625rem;
  }

  .btn-primary {
    width: 100%;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
