:root {
  color-scheme: dark;
  font-family: "Manrope", system-ui, sans-serif;
  --switcher-height: 58px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: #090a0d;
}

body {
  min-height: 100svh;
  overflow: hidden;
}

button {
  font: inherit;
}

.variant-stage {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.prototype-switcher {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 42px minmax(150px, auto) 42px;
  align-items: center;
  gap: 5px;
  min-height: var(--switcher-height);
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(8, 9, 12, 0.8);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(20px) saturate(140%);
  transform: translateX(-50%);
}

.switch-arrow,
.switch-label {
  color: #f7f5ef;
  border: 0;
  cursor: pointer;
}

.switch-arrow {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.2rem;
  transition: background 180ms ease, transform 180ms ease;
}

.switch-arrow:active {
  transform: scale(0.88);
  background: rgba(255, 255, 255, 0.24);
}

.switch-label {
  min-width: 0;
  padding: 0 9px;
  background: transparent;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* A — magnetic type */

.variant-a {
  display: grid;
  place-items: center;
  padding: 8vh 9vw calc(var(--switcher-height) + 9vh);
  color: #f4f1e9;
  background:
    radial-gradient(circle at 16% 16%, rgba(64, 120, 255, 0.28), transparent 27%),
    radial-gradient(circle at 86% 73%, rgba(216, 64, 143, 0.22), transparent 30%),
    #090a0d;
  cursor: crosshair;
  touch-action: none;
}

.variant-a::before,
.variant-a::after {
  position: absolute;
  z-index: -1;
  width: 70vw;
  height: 70vw;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.variant-a::before {
  transform: translate(-30vw, -27vh);
}

.variant-a::after {
  transform: translate(34vw, 28vh);
}

.a-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42vw;
  height: 42vw;
  max-width: 260px;
  max-height: 260px;
  border-radius: 50%;
  background: #5b73ff;
  filter: blur(80px);
  opacity: 0.25;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.a-lockup {
  width: min(100%, 540px);
  text-align: center;
}

.a-eyebrow {
  margin: 0 0 24px;
  color: rgba(244, 241, 233, 0.52);
  font-family: "DM Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.a-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.08em 0.2em;
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(3rem, 13vw, 7rem);
  font-weight: 500;
  letter-spacing: -0.075em;
  line-height: 0.9;
}

.a-word {
  display: inline-block;
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0) rotate(var(--rot, 0deg)) scale(var(--scale, 1));
  transition: transform 600ms cubic-bezier(0.17, 0.84, 0.32, 1.16), color 300ms ease;
  will-change: transform;
}

.a-word:first-child {
  color: #a4b7ff;
}

.a-word.is-near {
  color: #fff;
  transition-duration: 120ms;
}

.variant-a.a-pulse .a-word {
  animation: a-pulse 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i) * 38ms);
}

@keyframes a-pulse {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  42% { transform: translate3d(0, -12px, 0) scale(1.05); color: #fff; }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* B — swipe reveal */

.variant-b {
  display: grid;
  place-items: center;
  padding: 9vh 9vw calc(var(--switcher-height) + 9vh);
  color: #17212b;
  background: #e9edf2;
  cursor: ns-resize;
  touch-action: none;
}

.variant-b::before {
  position: absolute;
  inset: -15%;
  z-index: -1;
  background:
    radial-gradient(circle at 30% 22%, rgba(59, 154, 255, 0.62), transparent 27%),
    radial-gradient(circle at 76% 68%, rgba(255, 197, 87, 0.65), transparent 28%),
    radial-gradient(circle at 40% 90%, rgba(224, 100, 181, 0.42), transparent 33%);
  filter: blur(42px);
  opacity: 0.95;
  content: "";
  pointer-events: none;
  transform: rotate(-9deg) scale(1.1);
}

.b-panel {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 560px);
  min-height: min(72vh, 640px);
  padding: 9vw 5vw;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 32px;
  background: rgba(247, 250, 255, 0.38);
  box-shadow: 0 32px 90px rgba(50, 80, 110, 0.14), inset 0 1px rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(28px) saturate(140%);
}

.b-panel::before {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #17212b;
  box-shadow: 21px 0 #17212b, 42px 0 #17212b;
  content: "";
  opacity: 0.82;
}

.b-title {
  width: 100%;
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(3.2rem, 14vw, 7.2rem);
  font-weight: 600;
  letter-spacing: -0.105em;
  line-height: 0.87;
  text-align: center;
}

.b-line {
  display: block;
  overflow: hidden;
}

.b-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(115%);
  transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1), transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.b-line:first-child .b-word {
  opacity: 1;
  color: #17212b;
  transform: translateY(0);
}

.variant-b.is-revealed .b-word {
  opacity: 1;
  transform: translateY(0);
}

.b-line:nth-child(2) .b-word { transition-delay: 90ms; }
.b-line:nth-child(3) .b-word { transition-delay: 180ms; }

.b-rail {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 3px;
  height: 92px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 33, 43, 0.18);
}

.b-rail::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 28%;
  border-radius: inherit;
  background: #17212b;
  content: "";
  transition: height 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.variant-b.is-revealed .b-rail::after {
  height: 100%;
}

/* C — draggable message */

.variant-c {
  color: #f5f4ef;
  background:
    radial-gradient(circle at 50% 0%, rgba(194, 222, 109, 0.13), transparent 38%),
    #10131a;
  touch-action: none;
}

.variant-c::before {
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 28px;
  content: "";
  pointer-events: none;
}

.c-header {
  position: absolute;
  top: 8vh;
  left: 9vw;
  color: rgba(245, 244, 239, 0.48);
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.c-canvas {
  position: absolute;
  inset: 0;
}

.c-targets {
  position: absolute;
  right: 9vw;
  bottom: 20vh;
  left: 9vw;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  padding: 1rem 0;
  opacity: 0.65;
  transition: opacity 400ms ease;
}

.c-slot {
  width: 4.4rem;
  height: 2.55rem;
  border: 1px dashed rgba(245, 244, 239, 0.42);
  border-radius: 999px;
}

.c-slot:nth-child(5),
.c-slot:nth-child(6) {
  width: 6.4rem;
}

.c-word {
  position: absolute;
  top: var(--start-y);
  left: var(--start-x);
  z-index: 2;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-radius: 999px;
  color: #10131a;
  background: #d8ee79;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22), inset 0 1px rgba(255, 255, 255, 0.58);
  cursor: grab;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(0.95rem, 4vw, 1.25rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  transform: translate(-50%, -50%) rotate(var(--word-rotation, 0deg));
  transition: box-shadow 200ms ease, transform 450ms cubic-bezier(0.16, 1, 0.3, 1), background 250ms ease;
  user-select: none;
  touch-action: none;
}

.c-word:nth-child(2n) { background: #a6c8ff; }
.c-word:nth-child(3n) { background: #f7c6ed; }

.c-word:active,
.c-word.is-dragging {
  z-index: 4;
  cursor: grabbing;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.35), 0 0 0 5px rgba(216, 238, 121, 0.12);
  transform: translate(-50%, -50%) scale(1.08) rotate(0deg);
}

.c-word.is-placed {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(216, 238, 121, 0.13);
  transform: translate(-50%, -50%) rotate(0deg);
}

.variant-c.is-assembled .c-targets {
  opacity: 0.16;
}

.variant-c.is-assembled .c-word {
  background: #fff;
}

/* D — Fullscreen ASCII video */

.variant-d {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: normal;
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
  color: #f0ede5;
  background:
    radial-gradient(circle at 50% 52%, rgba(177, 113, 78, 0.10), transparent 34%),
    #1e282b;
  touch-action: pan-y;
}

.variant-d--light {
  color: #182125;
  background: #f7f6f1;
}

.d-meta,
.d-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 760px);
  margin: 0 auto;
  color: rgba(240, 237, 229, 0.56);
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
}

.d-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(234, 214, 189, 0.82);
}

.d-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e9a477;
  box-shadow: 0 0 14px #e9a477;
  animation: d-live-pulse 1.8s ease-in-out infinite;
}

@keyframes d-live-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1.15); }
}

.d-tv {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #111719;
  isolation: isolate;
  transform: translateZ(0);
}

.variant-d--light .d-tv {
  background: #f7f6f1;
}

.d-source-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.d-ascii-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.d-tv-label {
  position: absolute;
  right: 18px;
  bottom: 15px;
  z-index: 4;
  color: rgba(240, 237, 229, 0.48);
  font-family: "DM Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.d-tv-corner {
  position: absolute;
  z-index: 4;
  width: 28px;
  height: 28px;
  border-color: rgba(234, 214, 189, 0.5);
  pointer-events: none;
}

.d-tv-corner--tl {
  top: 14px;
  left: 17px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.d-tv-corner--br {
  right: 17px;
  bottom: 14px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.d-copy {
  position: relative;
  z-index: 5;
  width: min(100%, 760px);
  margin: auto auto 0;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.75);
}

.variant-d--light .d-copy {
  text-shadow: 0 2px 22px rgba(255, 255, 255, 0.88);
}

.d-kicker {
  margin: 0 0 12px;
  color: rgba(240, 237, 229, 0.5);
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.d-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.6rem, 10vw, 6.3rem);
  font-weight: 500;
  letter-spacing: -0.085em;
  line-height: 0.86;
}

.variant-d--light .d-title {
  color: #182125;
}

.d-title span {
  display: block;
}

.d-title span:first-child {
  color: #efc6a6;
}

.variant-d--light .d-title span:first-child,
.variant-d--light .d-hint span:last-child {
  color: #d56f3f;
}

.d-hint {
  position: relative;
  z-index: 5;
  margin: 16px auto 0;
  color: rgba(240, 237, 229, 0.42);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.variant-d--light .d-hint {
  color: rgba(24, 33, 37, 0.56);
  text-shadow: 0 2px 14px rgba(255, 255, 255, 0.86);
}

.d-hint span:last-child {
  color: #efc6a6;
  font-size: 1rem;
}

@media (min-width: 700px) {
  .variant-d {
    padding-right: 7vw;
    padding-left: 7vw;
  }
}

@media (min-width: 700px) {
  .variant-a,
  .variant-b {
    padding-right: 12vw;
    padding-left: 12vw;
  }

  .c-targets {
    right: 19vw;
    left: 19vw;
  }
}

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