@font-face {
  font-family: "Silkscreen";
  src: url("assets/fonts/Silkscreen-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Silkscreen";
  src: url("assets/fonts/Silkscreen-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --bg-raised: #11141b;
  --panel: #171b23;
  --line: #353d49;
  --white: #f5f3e8;
  --muted: #8f99a7;
  --yellow: #f4d35e;
  --cyan: #00c9d5;
  --red: #ff3b2f;
  --pixel-grid: 3px;
  --pixel: "Silkscreen", "Courier New", monospace;
  --ui: var(--pixel);
  --meta: "SFMono-Regular", "Roboto Mono", "Courier New", monospace;
  --sync-cycle: 3.6s;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  height: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  position: fixed;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  inset: 0;
  height: 100svh;
  height: 100dvh;
  width: 100%;
  min-height: 100svh;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  color: var(--white);
  background-color: var(--bg);
  font-family: var(--pixel);
  font-synthesis: none;
}

.radial-waves {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.radial-wave {
  position: absolute;
  top: var(--wave-y);
  left: var(--wave-x);
  width: clamp(132px, 18vmax, 220px);
  aspect-ratio: 1;
  opacity: 0;
  image-rendering: pixelated;
  transform: translate(-50%, -50%) scale(0.34);
  transform-origin: center;
  will-change: transform, opacity;
  animation: generated-wave-pulse var(--wave-life, 1500ms) steps(12, end) forwards;
}

.top-background-fade {
  position: absolute;
  z-index: 2;
  top: -1px;
  right: 0;
  left: 0;
  height: clamp(140px, 24svh, 260px);
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(11, 12, 16, 1) 0%,
    rgba(11, 12, 16, 0.82) 32%,
    rgba(11, 12, 16, 0.36) 68%,
    rgba(11, 12, 16, 0) 100%
  );
}

.pixel-shimmer {
  position: absolute;
  z-index: 25;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.58;
  mix-blend-mode: screen;
  image-rendering: pixelated;
}

body::before {
  content: "";
  position: absolute;
  z-index: 30;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%,
      rgba(245, 243, 232, 0.13) 0 0.55px,
      transparent 0.7px),
    linear-gradient(rgba(0, 0, 0, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.28) 1px, transparent 1px);
  background-size: var(--pixel-grid) var(--pixel-grid);
  mix-blend-mode: soft-light;
  opacity: 0.72;
}

.crt-overlay {
  display: none;
}

.crt-enabled .crt-overlay {
  position: absolute;
  z-index: 40;
  display: block;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(245, 243, 232, 0.018) 0,
      rgba(245, 243, 232, 0.018) 1px,
      rgba(0, 0, 0, 0.1) 1px,
      rgba(0, 0, 0, 0.1) 3px
    ),
    repeating-linear-gradient(
      to right,
      rgba(255, 59, 47, 0.018) 0,
      rgba(255, 59, 47, 0.018) 1px,
      rgba(0, 201, 213, 0.012) 1px,
      rgba(0, 201, 213, 0.012) 2px,
      rgba(90, 110, 255, 0.018) 2px,
      rgba(90, 110, 255, 0.018) 3px
    ),
    radial-gradient(
      ellipse at 50% 47%,
      transparent 45%,
      rgba(0, 0, 0, 0.08) 68%,
      rgba(0, 0, 0, 0.4) 100%
    );
  background-size: 100% 3px, 3px 100%, 100% 100%;
  box-shadow: inset 0 0 clamp(42px, 9vw, 130px) rgba(0, 0, 0, 0.4);
  opacity: 0.76;
  mix-blend-mode: normal;
  animation: crt-flicker 92ms steps(2, end) infinite;
}

.crt-enabled .crt-overlay::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent 0 6%,
    rgba(255, 59, 47, 0.2) 18%,
    rgba(245, 243, 232, 0.22) 48%,
    rgba(0, 201, 213, 0.2) 78%,
    transparent 94% 100%
  );
  opacity: 0.36;
  transform: translateY(4px);
  animation: crt-tracking 6.4s steps(1, end) infinite;
}

.crt-enabled .creator-copy strong,
.crt-enabled .coming-soon,
.crt-enabled .site-footer a,
.crt-enabled .store-badge {
  text-shadow:
    1px 0 rgba(255, 59, 47, 0.42),
    -1.25px 0 rgba(0, 201, 213, 0.38);
}

.crt-enabled body {
  animation: crt-screen-blink 115ms steps(2, end) infinite;
}

.crt-enabled .site-header,
.crt-enabled .hero,
.crt-enabled .site-footer {
  will-change: transform;
  animation: crt-content-jitter 172ms steps(2, end) infinite alternate;
}

.crt-enabled .creator,
.crt-enabled .icon-orbit,
.crt-enabled .logo-stage {
  filter:
    drop-shadow(1px 0 rgba(255, 59, 47, 0.2))
    drop-shadow(-1px 0 rgba(0, 201, 213, 0.2));
}

a { color: inherit; }

.site-header,
.hero,
.site-footer {
  position: relative;
  z-index: 5;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(1180px, calc(100% - 48px));
  min-height: clamp(52px, 9svh, 78px);
  margin: 0 auto;
  padding: clamp(8px, 1.5svh, 14px) 0 6px;
}

.creator {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--white);
  text-align: center;
  text-decoration: none;
}

.portrait-sprite {
  flex: 0 0 auto;
  width: clamp(68px, 13svh, 105px);
  aspect-ratio: 544 / 736;
  opacity: 0.2;
  background: url("assets/elliah-portrait-sheet.png") 0 0 / 300% 300% no-repeat;
  image-rendering: pixelated;
  animation: portrait-frames var(--sync-cycle) steps(1, end) infinite;
}

.creator-copy {
  display: grid;
  gap: 4px;
  opacity: 0.6;
}

.creator-copy strong {
  display: block;
  color: #fff;
  font-family: var(--ui);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: lowercase;
}

.site-footer a {
  position: relative;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.site-footer a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 1px;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible { color: var(--white); }

.site-footer a:hover::after,
.site-footer a:focus-visible::after { transform: scaleX(1); }

.hero {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: clamp(8px, 1.8svh, 14px) 24px;
  text-align: center;
}

.hero-copy {
  --coming-gap: 38px;
  display: grid;
  justify-items: center;
  width: min(720px, 100%);
  transform: translateY(clamp(-24px, -2.2svh, -14px));
}

.icon-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(148px, min(23vw, 26svh), 230px);
  aspect-ratio: 1;
  margin-bottom: clamp(18px, 3svh, 30px);
}

.game-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  border-radius: 23%;
  -webkit-clip-path: polygon(
    100% 50%, 99.57% 74.18%, 98.27% 82.63%, 96.06% 88.51%,
    92.86% 92.86%, 88.51% 96.06%, 82.63% 98.27%, 74.18% 99.57%,
    50% 100%, 25.82% 99.57%, 17.37% 98.27%, 11.49% 96.06%,
    7.14% 92.86%, 3.94% 88.51%, 1.73% 82.63%, 0.43% 74.18%,
    0% 50%, 0.43% 25.82%, 1.73% 17.37%, 3.94% 11.49%,
    7.14% 7.14%, 11.49% 3.94%, 17.37% 1.73%, 25.82% 0.43%,
    50% 0%, 74.18% 0.43%, 82.63% 1.73%, 88.51% 3.94%,
    92.86% 7.14%, 96.06% 11.49%, 98.27% 17.37%, 99.57% 25.82%
  );
  clip-path: polygon(
    100% 50%, 99.57% 74.18%, 98.27% 82.63%, 96.06% 88.51%,
    92.86% 92.86%, 88.51% 96.06%, 82.63% 98.27%, 74.18% 99.57%,
    50% 100%, 25.82% 99.57%, 17.37% 98.27%, 11.49% 96.06%,
    7.14% 92.86%, 3.94% 88.51%, 1.73% 82.63%, 0.43% 74.18%,
    0% 50%, 0.43% 25.82%, 1.73% 17.37%, 3.94% 11.49%,
    7.14% 7.14%, 11.49% 3.94%, 17.37% 1.73%, 25.82% 0.43%,
    50% 0%, 74.18% 0.43%, 82.63% 1.73%, 88.51% 3.94%,
    92.86% 7.14%, 96.06% 11.49%, 98.27% 17.37%, 99.57% 25.82%
  );
  background: #08090d;
  image-rendering: pixelated;
}

.logo-stage {
  position: relative;
  width: 226px;
  height: 49px;
  max-width: 100%;
  margin: 4px 0 0;
  overflow: hidden;
}

.logo-sprite {
  width: 129px;
  height: 28px;
  background-image: url("assets/kitaut-logo-sheet.png");
  background-repeat: no-repeat;
  background-position: -63px -114px;
  filter: drop-shadow(1px 1px 0 rgba(255, 255, 255, 0.12));
  image-rendering: pixelated;
  transform: scale(1.75);
  transform-origin: 0 0;
  animation: logo-frames var(--sync-cycle) steps(1, end) infinite;
}

.coming-soon {
  margin: var(--coming-gap) 0;
  color: var(--red);
  font-family: var(--ui);
  font-size: clamp(0.78rem, 2vw, 0.92rem);
  font-weight: 400;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgba(255, 59, 47, 0.24);
}

.store-row {
  display: grid;
  grid-template-columns: repeat(2, 56px);
  justify-items: center;
  justify-content: center;
  width: 100%;
  gap: 12px;
}

.store-badge {
  display: grid;
  place-items: center;
  align-items: center;
  width: 56px;
  height: 56px;
  padding: 10px;
  border: 1px solid rgba(245, 243, 232, 0.92);
  border-radius: 6px;
  opacity: 0.1;
  background: #030405;
  user-select: none;
}

.store-icon {
  display: block;
  width: 34px;
  height: 34px;
}

.apple-icon {
  width: 33px;
  height: 33px;
}

.play-icon { width: 34px; height: 34px; }

.site-footer {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 1.4svh, 14px);
  width: min(1180px, calc(100% - 48px));
  min-height: 0;
  margin: 0 auto;
  padding: clamp(8px, 1.7svh, 17px) 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.74rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-family: var(--ui);
  font-weight: 400;
  letter-spacing: 0;
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: clamp(18px, 3vw, 32px);
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

@keyframes portrait-frames {
  0%, 11.1% { background-position: 0 0; }
  11.2%, 22.2% { background-position: 50% 0; }
  22.3%, 33.3% { background-position: 100% 0; }
  33.4%, 44.4% { background-position: 0 50%; }
  44.5%, 55.5% { background-position: 50% 50%; }
  55.6%, 66.6% { background-position: 100% 50%; }
  66.7%, 77.7% { background-position: 0 100%; }
  77.8%, 88.8% { background-position: 50% 100%; }
  88.9%, 100% { background-position: 100% 100%; }
}

@keyframes logo-frames {
  0%, 11.1% { background-position: -63px -114px; }
  11.2%, 22.2% { background-position: -319px -114px; }
  22.3%, 33.3% { background-position: -575px -114px; }
  33.4%, 44.4% { background-position: -63px -370px; }
  44.5%, 55.5% { background-position: -319px -370px; }
  55.6%, 66.6% { background-position: -575px -370px; }
  66.7%, 77.7% { background-position: -63px -626px; }
  77.8%, 88.8% { background-position: -319px -626px; }
  88.9%, 100% { background-position: -575px -626px; }
}

@keyframes generated-wave-pulse {
  0% {
    opacity: var(--wave-opacity-start, 0.075);
    transform: translate(-50%, -50%) scale(0.28);
  }
  35% {
    opacity: var(--wave-opacity-mid, 0.0675);
    transform: translate(-50%, -50%) scale(4.7);
  }
  70% {
    opacity: var(--wave-opacity-far, 0.05);
    transform: translate(-50%, -50%) scale(9.4);
  }
  90% {
    opacity: var(--wave-opacity-end, 0.025);
    transform: translate(-50%, -50%) scale(12.6);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(14.4);
  }
}

@keyframes crt-flicker {
  0%, 100% { opacity: 0.76; }
  19% { opacity: 0.58; }
  37% { opacity: 0.84; }
  58% { opacity: 0.68; }
  76% { opacity: 0.88; }
  87% { opacity: 0.62; }
}

@keyframes crt-screen-blink {
  0%, 100% { opacity: 1; }
  13% { opacity: 0.94; }
  31% { opacity: 0.99; }
  48% { opacity: 0.9; }
  49% { opacity: 0.98; }
  72% { opacity: 0.95; }
  86% { opacity: 0.88; }
  87% { opacity: 1; }
}

@keyframes crt-content-jitter {
  0% { transform: translate(-0.2px, 0); }
  28% { transform: translate(0.2px, -0.2px); }
  54% { transform: translate(-0.2px, 0.2px); }
  76% { transform: translate(0.2px, 0); }
  100% { transform: translate(0, -0.2px); }
}

@keyframes crt-tracking {
  0%, 78%, 100% {
    opacity: 0;
    transform: translateY(4px);
  }
  79% {
    opacity: 0.24;
    transform: translateY(-22svh);
  }
  80% {
    opacity: 0.36;
    transform: translateY(-54svh);
  }
  81% {
    opacity: 0.18;
    transform: translateY(-82svh);
  }
  82% {
    opacity: 0;
    transform: translateY(-100svh);
  }
}

@media (max-width: 760px) {
  .hero-copy { --coming-gap: 42px; }

  .site-header {
    width: min(100% - 28px, 1180px);
    min-height: clamp(46px, 7svh, 64px);
    padding-top: 6px;
  }

  .portrait-sprite { width: clamp(116px, 16svh, 160px); }
  .creator { gap: 7px; }

  .hero {
    min-height: 0;
    padding: clamp(8px, 1.5svh, 15px) 18px;
  }

  .icon-orbit {
    width: clamp(130px, 18svh, 162px);
    margin-bottom: clamp(16px, 2.6svh, 28px);
  }

  .logo-stage { width: 149px; height: 33px; }
  .logo-sprite { transform: scale(1.15); }

  .site-footer {
    width: min(100% - 28px, 1180px);
    min-height: 0;
    margin-top: 0;
    padding: clamp(8px, 1.5svh, 15px) 0 32px;
  }

  .site-footer .footer-links { flex-wrap: wrap; row-gap: 14px; }
  .site-footer a { font-size: 0.66rem; }
}

@media (prefers-reduced-motion: reduce) {
  .radial-waves { display: none; }

  .crt-enabled .crt-overlay,
  .crt-enabled .crt-overlay::after {
    animation: none;
  }

  .crt-enabled .crt-overlay::after {
    display: none;
  }
}

@media (max-width: 390px) {
  .hero { padding-top: 20px; }

  .store-row { gap: 6px; }

  .store-badge {
    width: 52px;
    height: 52px;
    padding: 9px;
  }

  .store-row { grid-template-columns: repeat(2, 52px); }
  .store-icon,
  .apple-icon,
  .play-icon { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
