:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #262626;
  color: #f5f5f5;
}

* {
  box-sizing: border-box;
}

html {
  overflow: hidden;
}

body {
  width: 100vw;
  height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  overscroll-behavior: none;
}

.corner-control {
  position: fixed;
  z-index: 10;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  color: #fff;
  background: transparent;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  opacity: 0.33;
  -webkit-tap-highlight-color: transparent;
}

.corner-control:hover,
.corner-control:focus-visible {
  opacity: 1;
}

.corner-control:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0.25rem;
}

.corner-control svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back-control {
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
}

.sound-toggle {
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
}

.sound-icon--on {
  display: none;
}

.sound-toggle[aria-pressed="true"] .sound-icon--on {
  display: inline;
}

.sound-toggle[aria-pressed="true"] .sound-icon--off {
  display: none;
}

/*
  Reusable SVG animation component.
  Override --asset-size or --fade-duration
  on .svg-animation to tune each instance.
*/
.svg-animation {
  --asset-size: 220px;
  --fade-duration: 0.25s;

  width: var(--asset-size);
  height: var(--asset-size);
  cursor: pointer;
  outline-offset: 0.5rem;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
  position: relative;
}

.svg-animation:focus {
  outline: none;
}

.svg-animation:focus-visible {
  outline: 2px solid currentColor;
}

.svg-animation__track {
  display: grid;
  width: var(--asset-size);
  height: var(--asset-size);
  transform-origin: center;
  filter: drop-shadow(0 0.4rem 0.45rem rgb(0 0 0 / 65%));
  will-change: transform;
}

.svg-animation__image {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  transition: opacity var(--fade-duration) ease-in-out;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.svg-animation__image--second {
  opacity: 0;
}

.svg-animation__color-overlay {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: color;
}

.svg-animation[data-visible-image="second"] .svg-animation__image--first {
  opacity: 0;
}

.svg-animation[data-visible-image="second"] .svg-animation__image--second {
  opacity: 1;
}

.gesture-hints {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gesture-hint {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 240ms ease, transform 240ms ease;
}

.gesture-hint svg {
  width: 1.7rem;
  height: 1.7rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gesture-hint--top {
  bottom: calc(100% + 8rem);
  transform: translate(-50%, 0.4rem);
}

.gesture-hint--bottom {
  top: calc(100% + 8rem);
  transform: translate(-50%, -0.4rem);
}

.gesture-hints[data-visible="true"] .gesture-hint {
  opacity: 0.8;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .svg-animation__image {
    transition-duration: 1ms;
  }

  .gesture-hint {
    transition: none;
  }
}

/* Desktop / larger screens */
@media (min-width: 768px) {
  .corner-control {
    width: 5rem;
    height: 5rem;
  }

  .corner-control svg {
    width: 2.7rem;
    height: 2.7rem;
  }

  .svg-animation {
    --asset-size: 350px;
  }
}
