:root {
  --bg: #0b1020;
  --panel: #121a30;
  --panel-soft: #182342;
  --text: #e8edff;
  --muted: #a9b6db;
  --accent: #70e7c2;
  --accent-strong: #51d0a9;
  --border: #2a365b;
  --shadow: 0 20px 55px rgba(2, 6, 20, 0.48);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(42, 72, 150, 0.55) 0%, rgba(42, 72, 150, 0) 44%),
    radial-gradient(circle at 95% 10%, rgba(59, 142, 131, 0.4) 0%, rgba(59, 142, 131, 0) 38%),
    linear-gradient(160deg, #0b1020 0%, #090f1e 55%, #070c19 100%);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

body > * {
  position: relative;
  z-index: 1;
}

.bg-puzzle {
  position: fixed;
  inset: -14vmax;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-puzzle::before,
.bg-puzzle::after {
  content: "";
  position: absolute;
  inset: 0;
}

.bg-puzzle::before {
  background:
    radial-gradient(circle at 12% 16%, rgba(92, 179, 255, 0.2) 0%, rgba(92, 179, 255, 0) 25%),
    radial-gradient(circle at 84% 14%, rgba(112, 231, 194, 0.17) 0%, rgba(112, 231, 194, 0) 29%),
    radial-gradient(circle at 49% 85%, rgba(145, 121, 255, 0.14) 0%, rgba(145, 121, 255, 0) 27%),
    linear-gradient(90deg, rgba(136, 157, 220, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(136, 157, 220, 0.16) 1px, transparent 1px),
    radial-gradient(circle, rgba(151, 173, 236, 0.19) 1px, transparent 1.4px);
  background-size:
    auto,
    auto,
    auto,
    34px 34px,
    34px 34px,
    34px 34px;
  background-position:
    center,
    center,
    center,
    0 0,
    0 0,
    17px 17px;
  opacity: 0.45;
  -webkit-mask-image: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 1) 28%,
    rgba(0, 0, 0, 0.72) 68%,
    transparent 100%
  );
  mask-image: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 1) 28%,
    rgba(0, 0, 0, 0.72) 68%,
    transparent 100%
  );
  animation: puzzle-grid-drift 28s linear infinite;
}

.bg-puzzle::after {
  background: linear-gradient(
    115deg,
    transparent 32%,
    rgba(112, 231, 194, 0.22) 47%,
    rgba(112, 231, 194, 0.08) 51%,
    transparent 62%
  );
  opacity: 0.4;
  filter: blur(0.5px);
  animation: puzzle-scan 9s ease-in-out infinite;
}

@keyframes puzzle-grid-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate3d(-18px, -14px, 0) scale(1.02) rotate(-0.8deg);
  }
  100% {
    transform: translate3d(-36px, -28px, 0) scale(1.04) rotate(-1.2deg);
  }
}

@keyframes puzzle-scan {
  0%,
  100% {
    transform: translateX(-35%) translateY(-8%) rotate(-2deg);
    opacity: 0.15;
  }
  50% {
    transform: translateX(28%) translateY(6%) rotate(-2deg);
    opacity: 0.5;
  }
}

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

a {
  color: inherit;
}

.hero,
.modes,
.viewer {
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  padding: 3rem 0 2rem;
  text-align: center;
}

.hero__logo-wrap {
  margin: 0 auto 1.25rem;
  width: min(230px, 60vw);
}

.hero__logo {
  filter: drop-shadow(0 8px 24px rgba(112, 231, 194, 0.35));
}

.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 0.76rem;
  margin: 0 0 0.65rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
}

h1 {
  font-size: clamp(2.15rem, 5vw, 3.3rem);
}

.hero__subhead {
  color: var(--muted);
  font-size: 1.04rem;
  margin: 0.6rem 0;
}

.hero__body {
  max-width: 64ch;
  margin: 0.3rem auto 0;
}

.hero__body--compact {
  margin-top: 0.8rem;
  color: var(--muted);
}

.hero__actions {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.hero__cta,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0;
  padding: 0.62rem 1.05rem;
  border: 1px solid #304268;
  border-radius: 0.72rem;
  background: linear-gradient(180deg, #1d2c53, #172444);
  color: #f2f6ff;
  text-decoration: none;
  font-weight: 700;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 8px 18px rgba(2, 8, 24, 0.35);
}

.hero__cta {
  border-color: rgba(112, 231, 194, 0.48);
  color: var(--accent);
  background: linear-gradient(180deg, #1d334e, #16283e);
}

.hero__cta:hover,
.button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 10px 22px rgba(81, 208, 169, 0.2);
}

.button--ghost {
  border-color: var(--border);
  background: rgba(18, 26, 48, 0.75);
  color: var(--text);
}

.modes {
  margin-top: 1.1rem;
}

.modes h2 {
  font-size: clamp(1.3rem, 3.8vw, 1.75rem);
  margin-bottom: 0.9rem;
}

.modes__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.mode-card {
  padding: 1.15rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  box-shadow: var(--shadow);
}

.mode-card h3 {
  font-size: 1.1rem;
}

.mode-card p {
  margin: 0.65rem 0 0;
  color: var(--muted);
}

.mode-card .button {
  margin-top: 0.95rem;
}

.viewer {
  margin-top: 1.2rem;
  margin-bottom: 2.8rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: linear-gradient(175deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  box-shadow: var(--shadow);
  overflow: clip;
}

.viewer__topbar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 25, 49, 0.8);
  padding: 0.85rem 1rem;
}

.viewer__label,
.viewer__progress {
  margin: 0;
  font-size: 0.92rem;
}

.viewer__label {
  color: var(--muted);
}

.slide {
  display: none;
  padding: 1.15rem;
  gap: 1rem;
}

.slide.is-active {
  display: grid;
}

.slide h3 {
  font-size: clamp(1.22rem, 3.8vw, 1.6rem);
}

.slide p {
  margin: 0.65rem 0 0;
  color: #dde5ff;
}

.slide__glyphs {
  font-size: 1.45rem;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.slide__pair,
.slide__triptych {
  display: grid;
  gap: 0.8rem;
}

.slide__pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.slide__triptych {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.slide__image {
  margin: 0;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  padding: 0.65rem;
}

.slide__image img {
  width: 100%;
  border-radius: 0.5rem;
  background: #fff;
}

.slide__image figcaption {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.pager {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 0 1.15rem 1rem;
}

.pager__button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(24, 35, 66, 0.95), rgba(14, 22, 43, 0.95));
  border-radius: 0.72rem;
  padding: 0.58rem 0.9rem;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.pager__button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.pager__button:focus-visible,
.hero__cta:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pager__button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.pager__hint {
  grid-column: 1 / -1;
  margin: 0.15rem 0 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .bg-puzzle::before,
  .bg-puzzle::after {
    animation: none;
    transform: none;
  }
}

@media (max-width: 860px) {
  .modes__grid,
  .slide__pair {
    grid-template-columns: 1fr;
  }

  .slide__triptych {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .hero,
  .modes,
  .viewer {
    width: min(1040px, calc(100% - 1rem));
  }

  .slide {
    padding: 0.9rem;
  }

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

  .pager {
    grid-template-columns: 1fr;
  }
  
  .bg-puzzle::before {
    opacity: 0.32;
  }

  .bg-puzzle::after {
    opacity: 0.28;
  }
}
