:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #120d18;
  color: #fff7d6;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100%;
  min-height: 100svh;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 14%, rgba(255, 199, 95, 0.22), transparent 26rem),
    linear-gradient(145deg, #100e1b 0%, #251628 48%, #3a1e22 100%);
  touch-action: none;
}

body.is-lab-variant {
  background: #05070d;
}

button {
  font: inherit;
}

.stage {
  position: fixed;
  inset: 0;
  width: var(--app-width, 100vw);
  height: 100vh;
  height: 100lvh;
  height: var(--app-height, 100lvh);
  min-width: 320px;
  min-height: 100dvh;
  isolation: isolate;
  overflow: hidden;
}

.variant-layer {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 320ms ease, visibility 320ms ease;
}

.variant-layer.is-active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.variant-frame {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: var(--app-width, 100vw);
  height: 100vh;
  height: 100lvh;
  height: var(--app-height, 100lvh);
  min-height: 100dvh;
  border: 0;
  background: #05070d;
}

.variant-hint {
  position: fixed;
  top: clamp(18px, 4vw, 32px);
  left: 50%;
  z-index: 5;
  color: rgba(255, 247, 214, 0.72);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.26em;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 240ms ease;
  mix-blend-mode: screen;
  white-space: nowrap;
}

.variant-hint.is-visible {
  opacity: 1;
}

.variant-nav {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  width: var(--app-width, 100vw);
  height: var(--app-height, 100vh);
  pointer-events: none;
}

.variant-step {
  position: absolute;
  top: 50%;
  display: grid;
  width: 44px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(255, 247, 214, 0.22);
  border-radius: 8px;
  background: rgba(5, 7, 13, 0.22);
  color: rgba(255, 247, 214, 0.78);
  cursor: pointer;
  opacity: 0.52;
  pointer-events: auto;
  transform: translateY(-50%);
  transition: opacity 160ms ease, background 160ms ease, border-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.variant-step::before {
  width: 13px;
  height: 13px;
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  content: "";
}

.variant-prev {
  left: 10px;
  left: max(10px, env(safe-area-inset-left));
}

.variant-prev::before {
  transform: translateX(3px) rotate(-45deg);
}

.variant-next {
  right: 10px;
  right: max(10px, env(safe-area-inset-right));
}

.variant-next::before {
  transform: translateX(-3px) rotate(135deg);
}

.variant-step:hover,
.variant-step:focus-visible {
  border-color: rgba(255, 247, 214, 0.5);
  background: rgba(5, 7, 13, 0.38);
  opacity: 0.86;
  outline: none;
}

.variant-step:active {
  opacity: 1;
}

#memory-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #120d18;
  cursor: crosshair;
}

@media (max-width: 680px) {
  .variant-hint {
    top: calc(env(safe-area-inset-top) + 15px);
    max-width: calc(100vw - 36px);
    overflow: hidden;
    font-size: 9px;
    letter-spacing: 0.18em;
    text-overflow: ellipsis;
  }

  .variant-nav {
    top: auto;
    bottom: calc(env(safe-area-inset-bottom) + 88px);
    left: max(8px, env(safe-area-inset-left));
    display: flex;
    width: 112px;
    height: 56px;
    gap: 8px;
  }

  .variant-step {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 48px;
    height: 56px;
    opacity: 0.72;
    transform: none;
  }

  .variant-prev {
    left: auto;
  }

  .variant-next {
    right: auto;
  }

}

@media (prefers-reduced-motion: reduce) {
  #memory-canvas {
    cursor: default;
  }
}
