:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #03010d;
  color: #f5f2eb;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #03010d;
}

button {
  font: inherit;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 32rem;
  isolation: isolate;
  overflow: hidden;
  background: #03010d;
}

#prism,
.fallback {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
}

#prism {
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.fallback {
  display: none;
  background-color: #08011e;
  background-image: radial-gradient(circle at 50% 50%, transparent 0 18%, #f3efff 18.5% 19%, transparent 19.5%),
    conic-gradient(from 15deg at 50% 50%, #ff316c, #7b4dff, #08d9ff, #dfff47, #ff8a2a, #ff316c);
  filter: saturate(1.35) contrast(1.15);
}

.stage.no-webgl #prism {
  display: none;
}

.stage.no-webgl .fallback {
  display: block;
}

.masthead {
  position: absolute;
  z-index: 2;
  top: clamp(1.25rem, 3.5vw, 3rem);
  left: clamp(1.25rem, 3.5vw, 3rem);
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  mix-blend-mode: difference;
  pointer-events: none;
}

.masthead p,
.masthead h1,
.material,
.instruction,
.status {
  margin: 0;
  font-size: clamp(0.65rem, 1vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.masthead h1 {
  font-size: clamp(0.78rem, 1.2vw, 0.98rem);
}

.material {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: clamp(1.25rem, 3.5vw, 3rem);
  line-height: 1.45;
  transform: translateY(-50%);
  mix-blend-mode: difference;
  pointer-events: none;
}

.instruction {
  position: absolute;
  z-index: 2;
  right: clamp(1.25rem, 3.5vw, 3rem);
  bottom: clamp(4.7rem, 8vw, 6.2rem);
  padding: 0.35rem 0.45rem;
  line-height: 1.45;
  text-align: right;
  background: rgba(3, 1, 13, 0.66);
  pointer-events: none;
}

.controls {
  position: absolute;
  z-index: 3;
  right: clamp(1.25rem, 3.5vw, 3rem);
  bottom: clamp(1.25rem, 3.5vw, 3rem);
  display: flex;
  border: 1px solid rgba(245, 242, 235, 0.8);
  background: rgba(3, 1, 13, 0.72);
}

.controls button {
  min-width: 6.2rem;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-right: 1px solid rgba(245, 242, 235, 0.8);
  border-radius: 0;
  color: #f5f2eb;
  background: transparent;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.controls button:last-child {
  border-right: 0;
}

.controls button:hover:not(:disabled) {
  color: #03010d;
  background: #f5f2eb;
}

.controls button:disabled {
  opacity: 0.42;
  cursor: default;
}

.controls button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid #ff356f;
  outline-offset: 3px;
}

.status {
  position: absolute;
  z-index: 2;
  top: clamp(1.25rem, 3.5vw, 3rem);
  right: clamp(1.25rem, 3.5vw, 3rem);
  mix-blend-mode: difference;
  pointer-events: none;
}

@media (max-width: 40rem) {
  .stage {
    min-height: 28rem;
  }

  .material {
    top: auto;
    bottom: 5rem;
    transform: none;
  }

  .instruction {
    right: 1.25rem;
    bottom: 5rem;
  }

  .controls {
    right: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .instruction {
    display: none;
  }
}
