:root {
  color-scheme: dark;
  --bg: #09091a;
  --surface: rgba(21, 21, 47, 0.76);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f3ff;
  --muted: #aaa8c4;
  --accent: #d4ff3f;
  --accent-ink: #12140a;
  --violet: #895cff;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(137, 92, 255, 0.24), transparent 32rem),
    radial-gradient(circle at 100% 100%, rgba(212, 255, 63, 0.1), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #05050d;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.45);
}

.topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  padding: max(24px, env(safe-area-inset-top)) 16px 26px;
  background: linear-gradient(to bottom, rgba(4, 4, 13, 0.78), transparent);
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.counter {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  right: 16px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.stage {
  position: relative;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: rgba(5, 5, 16, 0.5);
  isolation: isolate;
}

.stage::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
}

.stage-glow {
  position: absolute;
  width: 60%;
  height: 40%;
  border-radius: 50%;
  background: var(--violet);
  filter: blur(100px);
  opacity: 0.18;
  pointer-events: none;
}

.image-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.image-wrap.is-changing img {
  animation: arrive 780ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#particleCanvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.stage-label {
  position: absolute;
  right: 50%;
  bottom: 164px;
  z-index: 4;
  transform: translateX(50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(8, 8, 22, 0.56);
  color: var(--muted);
  backdrop-filter: blur(12px);
  font-size: 11px;
}

.signal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.controls {
  position: absolute;
  right: 16px;
  bottom: max(36px, env(safe-area-inset-bottom));
  left: 16px;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 380px;
  margin: 0 auto;
}

.button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 18px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.motion-intro {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 7;
  display: grid;
  gap: 4px;
  min-width: 210px;
  padding: 17px 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  background: rgba(6, 6, 18, 0.48);
  color: var(--text);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity 260ms ease, visibility 260ms ease, background 180ms ease;
  backdrop-filter: blur(14px);
  -webkit-tap-highlight-color: transparent;
}

.motion-intro:hover {
  background: rgba(19, 19, 42, 0.68);
}

.motion-intro:focus-visible,
.desktop-shake:focus-visible {
  outline: 3px solid rgba(212, 255, 63, 0.55);
  outline-offset: 3px;
}

.motion-intro.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.motion-intro-title {
  font-size: 17px;
  font-weight: 800;
}

.motion-intro-subtitle {
  color: rgba(245, 243, 255, 0.66);
  font-size: 12px;
}

.desktop-shake {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .desktop-shake {
    position: absolute;
    right: 50%;
    bottom: 20px;
    z-index: 8;
    display: block;
    min-width: 120px;
    padding: 11px 22px;
    border: 1px solid rgba(212, 255, 63, 0.55);
    border-radius: 999px;
    background: rgba(6, 6, 18, 0.62);
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    transform: translateX(50%);
    backdrop-filter: blur(14px);
  }

  .desktop-shake:hover {
    background: var(--accent);
    color: var(--accent-ink);
  }
}

.button:active {
  transform: scale(0.98);
}

.button:focus-visible {
  outline: 3px solid rgba(212, 255, 63, 0.45);
  outline-offset: 3px;
}

.button-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

.button-primary:hover {
  background: #e1ff70;
}

.button-icon {
  font-size: 23px;
  line-height: 0;
}

.button-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(37, 37, 70, 0.82);
}

.button-arrow {
  color: var(--accent);
  font-size: 20px;
}

.status {
  position: absolute;
  right: 16px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 16px;
  z-index: 6;
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: scale(0.84) rotate(-2deg);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
    filter: blur(0);
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: 104px;
  }

  h1 {
    font-size: 34px;
  }

  .counter {
    right: 12px;
  }

  .controls {
    right: 16px;
    left: 16px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .button {
    min-height: 52px;
  }

  .stage-label {
    bottom: 164px;
  }
}

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