/* Apple clarity + Material 3 tokens (Roboto, surfaces, shape) */
:root {
  color-scheme: light;

  /* M3-style roles mapped to brand */
  --md-primary: #556447;
  --md-on-primary: #ffffff;
  --md-primary-container: #dce8d0;
  --md-on-primary-container: #141f0e;
  --md-surface: #fffbff;
  --md-surface-container-low: #f3f3f3;
  --md-surface-container: #eeeeee;
  --md-on-surface: #1a1c18;
  --md-on-surface-variant: #44483e;
  --md-outline-variant: #c4c8bb;

  /* Layout aliases */
  --bg: var(--md-surface);
  --bg-muted: var(--md-surface-container-low);
  --text: var(--md-on-surface);
  --text-secondary: var(--md-on-surface-variant);
  --text-tertiary: #74796d;
  --accent-brand: var(--md-primary);
  --line: var(--md-outline-variant);

  --font-display: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --shape-xl: 28px;
  --shape-lg: 16px;
  --shape-full: 9999px;

  --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  --elevation-2: 0 2px 6px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
  --device-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);

  --max: 980px;
  --max-wide: 1060px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.009em;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-brand);
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--md-primary);
  color: var(--md-on-primary);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* --- Header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  background: color-mix(in srgb, var(--md-surface) 88%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 12px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav-cta {
  padding: 0.5rem 1rem;
  border-radius: var(--shape-full);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.006em;
  color: var(--md-primary);
  background: var(--md-primary-container);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.nav-cta:hover {
  background: color-mix(in srgb, var(--md-primary-container) 80%, var(--md-primary) 20%);
  box-shadow: var(--elevation-1);
}

/* --- Buttons & Play badge --- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.625rem 1.5rem;
  border-radius: var(--shape-full);
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.006em;
  text-decoration: none;
  box-shadow: var(--elevation-1);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--md-primary) 88%, #000 12%);
  box-shadow: var(--elevation-2);
}

.play-badge {
  display: inline-block;
  line-height: 0;
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.play-badge img {
  width: min(100%, 200px);
  height: auto;
}

.play-badge-lg img {
  width: min(100%, 220px);
}

.play-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--elevation-2);
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.625rem 1.5rem;
  border-radius: var(--shape-full);
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--elevation-1);
}

/* --- Hero (display scale) --- */

.hero {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
}

.hero-content {
  max-width: 640px;
  margin: 0 auto 2rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 6.5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.hero-sub {
  margin: 0 auto 1.5rem;
  max-width: 480px;
  font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
  line-height: 1.5;
  color: var(--text-secondary);
}

.hero-actions {
  margin-bottom: 1.25rem;
}

.nowrap {
  white-space: nowrap;
}

.game-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game-chips li {
  padding: 0.375rem 0.75rem;
  border-radius: var(--shape-full);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
}

.game-chips .chip-muted {
  color: var(--text-secondary);
  background: var(--md-surface-container);
}

.hero-device {
  margin: 0 auto;
  width: min(100%, 260px);
  padding: 0.5rem;
  border-radius: var(--shape-xl);
  background: var(--md-surface-container);
  box-shadow: var(--device-shadow);
}

.hero-device img {
  width: 100%;
  border-radius: calc(var(--shape-xl) - 8px);
}

@media (min-width: 900px) {
  .hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem 3.5rem;
    align-items: center;
    text-align: left;
    padding-top: 4rem;
    padding-bottom: 5rem;
  }

  .hero-content {
    margin: 0;
    max-width: none;
  }

  .hero-sub {
    margin-left: 0;
  }

  .game-chips {
    justify-content: flex-start;
  }

  .hero-device {
    width: min(100%, 280px);
    margin-left: auto;
    margin-right: 0;
  }
}

/* --- Feature bands (headline scale) --- */

.band {
  padding: 4rem 1.5rem;
}

.band-muted {
  background: var(--bg-muted);
}

.band-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.feature-row {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.feature-text h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.feature-text p {
  margin: 0;
  max-width: 420px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.feature-device {
  margin: 0 auto;
  width: min(100%, 240px);
  padding: 0.5rem;
  border-radius: var(--shape-xl);
  background: var(--md-surface-container);
  box-shadow: var(--device-shadow);
}

.feature-device img {
  width: 100%;
  border-radius: calc(var(--shape-xl) - 8px);
}

@media (min-width: 834px) {
  .band {
    padding: 5rem 1.5rem;
  }

  .feature-row {
    grid-template-columns: 1fr minmax(200px, 280px);
    gap: 4rem;
  }

  .feature-row-reverse {
    grid-template-columns: minmax(200px, 280px) 1fr;
  }

  .feature-row-reverse .feature-text {
    order: 2;
  }

  .feature-row-reverse .feature-device {
    order: 1;
    margin-left: 0;
    margin-right: auto;
  }

  .feature-row:not(.feature-row-reverse) .feature-device {
    margin-left: auto;
    margin-right: 0;
  }
}

/* --- Highlight cards (M3 surfaces) --- */

.highlights {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.highlight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 734px) {
  .highlight-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

.surface-card {
  padding: 1.25rem 1.25rem 1.5rem;
  border-radius: var(--shape-lg);
  background: var(--md-surface-container-low);
  box-shadow: var(--elevation-1);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.surface-card:hover {
  background: var(--md-surface-container);
  box-shadow: var(--elevation-2);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.75rem;
  border-radius: 12px;
  color: var(--md-primary);
  background: var(--md-primary-container);
}

.highlight-list strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
}

.highlight-list span {
  display: block;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* --- CTA --- */

.band-cta {
  padding: 4.5rem 1.5rem 5rem;
  text-align: center;
  background: linear-gradient(
    180deg,
    var(--bg) 0%,
    var(--md-primary-container) 100%
  );
}

.cta-block h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 4.5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.cta-sub {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* --- Footer --- */

.site-footer {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.footer-copy {
  margin: 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
}

.footer-nav a {
  color: var(--text-tertiary);
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--text);
}

/* --- Challenge page --- */

.page-narrow {
  max-width: 480px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.challenge-main {
  padding-top: 2rem;
}

.challenge-main .eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.challenge-main h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.015em;
}

.challenge-main .lede {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

.hint,
.code {
  margin: 1rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.code {
  word-break: break-all;
}

.footer-dot {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .play-badge:hover,
  .btn-primary:hover {
    transform: none;
  }
}
