@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/fonts/SpaceGrotesk-400.ttf?v=1.0.3") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/fonts/SpaceGrotesk-500.ttf?v=1.0.3") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/fonts/SpaceGrotesk-700.ttf?v=1.0.3") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg-top: #f3f8ff;
  --bg-bottom: #dce8ff;
  --ink: #1a1e2b;
  --muted: #5b6175;
  --scatter-strength-x: 1;
  --scatter-strength-y: 1;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-border: rgba(255, 255, 255, 0.88);
  --card-shadow: 0 20px 60px rgba(33, 49, 92, 0.22);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 2vw, 2rem);
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  touch-action: manipulation;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.8), transparent 45%),
    radial-gradient(circle at 86% 90%, rgba(142, 181, 255, 0.35), transparent 42%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0) 45%,
    rgba(140, 172, 238, 0.22) 100%
  );
}

.app {
  width: min(100%, 980px);
}

.stage {
  position: relative;
  min-height: min(80svh, 760px);
  padding: clamp(1.5rem, 4vw, 3.2rem);
  border-radius: 30px;
  border: 1px solid var(--surface-border);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(8px);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  animation: stage-in 220ms ease-out both;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.8rem, 1.8vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.title {
  margin: 0.7rem 0 0;
  font-size: clamp(2rem, 7vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.copy {
  margin: 1rem 0 0;
  max-width: 38ch;
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  line-height: 1.4;
}

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

.hint {
  margin: 2.1rem 0 0;
  font-size: clamp(0.92rem, 2vw, 1.08rem);
  color: var(--muted);
}

.intro-logo {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 140ms ease;
}

.intro-logo:hover,
.intro-logo:focus-visible {
  opacity: 1;
}

.intro-logo img {
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: center center;
  animation: logo-rotate 18s linear infinite;
}

.countdown {
  margin: 0.6rem 0 0;
  font-size: clamp(4rem, 20vw, 11rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #111111;
  animation: countdown-pop 420ms ease-out both;
}

.stimulus-wrap {
  min-height: clamp(6rem, 20vh, 12rem);
  display: grid;
  place-items: center;
  margin-top: 1rem;
}

.stimulus-word {
  margin: 0;
  font-size: clamp(1.82rem, 8.8vw, 5.7rem);
  line-height: 1.04;
  letter-spacing: 0.01em;
  font-weight: 700;
  transform-origin: center center;
  transform: translate(
    calc(var(--scatter-x, 0px) * var(--scatter-strength-x, 1)),
    calc(var(--scatter-y, 0px) * var(--scatter-strength-y, 1))
  );
  user-select: none;
  animation: word-in 160ms ease-out both;
}

.stimulus-word.is-yellow {
  text-shadow:
    0 3px 12px rgba(0, 0, 0, 0.28),
    0 0 2px rgba(0, 0, 0, 0.45);
  -webkit-text-stroke: 0.8px rgba(0, 0, 0, 0.28);
}

.result-list {
  width: min(100%, 600px);
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(246, 249, 255, 0.88);
  border: 1px solid rgba(211, 221, 246, 0.9);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
}

.result-row strong {
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes word-in {
  from {
    opacity: 0;
    filter: blur(1px);
  }

  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes countdown-pop {
  from {
    transform: scale(0.86);
    opacity: 0.2;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes logo-rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 480px) {
  :root {
    --scatter-strength-x: 0.4;
    --scatter-strength-y: 0.6;
  }

  .stage {
    min-height: min(84svh, 680px);
    border-radius: 24px;
    padding: 1.2rem;
  }

  .stimulus-word {
    font-size: clamp(2.1rem, 12.2vw, 5.8rem);
  }

  .intro-logo {
    width: 26px;
    height: 26px;
  }

  .result-row {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
  }
}
