:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #bcb9af;
  color: #11120f;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

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

.stage::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.masthead {
  position: absolute;
  z-index: 4;
  top: clamp(1.25rem, 3.5vw, 3rem);
  left: clamp(1.25rem, 3.5vw, 3rem);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.8rem;
  pointer-events: none;
}

.index,
.masthead h1,
.instruction,
.status,
.word {
  margin: 0;
  text-transform: uppercase;
}

.index {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.masthead h1 {
  font-size: clamp(0.78rem, 1.2vw, 0.98rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.field {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

.word {
  position: absolute;
  left: 50%;
  bottom: 21%;
  display: flex;
  align-items: flex-end;
  color: #11120f;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(7rem, 25vw, 23rem);
  font-weight: 900;
  line-height: 0.72;
  letter-spacing: -0.08em;
  white-space: nowrap;
  user-select: none;
  transform: translateX(-50%);
  transform-origin: center bottom;
  pointer-events: none;
}

.letter {
  display: block;
  min-width: 0;
  transform: translate3d(var(--x, 0), var(--y, 0), 0)
    scale(var(--sx, 1), var(--sy, 1)) rotate(var(--r, 0deg));
  transform-origin: center bottom;
  will-change: transform;
}

.floor {
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: calc(21% - 0.4rem);
  left: 0;
  height: 1px;
  background: rgba(17, 18, 15, 0.55);
}

.pressure {
  --pressure-x: 50vw;
  --pressure-y: 35vh;
  position: absolute;
  z-index: 2;
  top: 0;
  left: var(--pressure-x);
  width: 1px;
  height: var(--pressure-y);
  background: #ed3d26;
  opacity: 0;
  transform: translateX(-0.5px);
  pointer-events: none;
}

.pressure.is-active {
  opacity: 1;
}

.weight {
  position: absolute;
  right: -0.85rem;
  bottom: -0.7rem;
  width: 1.7rem;
  height: 1.4rem;
  border: 1px solid #11120f;
  background: #ed3d26;
}

.instruction {
  position: absolute;
  z-index: 4;
  right: clamp(1.25rem, 3.5vw, 3rem);
  bottom: clamp(1.4rem, 3.5vw, 3rem);
  max-width: 12rem;
  font-size: clamp(0.66rem, 1vw, 0.8rem);
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.08em;
  text-align: right;
  pointer-events: none;
}

.controls {
  position: absolute;
  z-index: 5;
  left: clamp(1.25rem, 3.5vw, 3rem);
  bottom: clamp(1.25rem, 3.5vw, 3rem);
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(17, 18, 15, 0.78);
  background: rgba(188, 185, 175, 0.88);
}

.controls button {
  min-width: 5.2rem;
  min-height: 2.7rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-right: 1px solid rgba(17, 18, 15, 0.78);
  border-radius: 0;
  color: #11120f;
  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 {
  color: #e6e2d7;
  background: #11120f;
}

.controls button:disabled {
  color: rgba(17, 18, 15, 0.5);
  background: transparent;
  cursor: default;
}

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

.status {
  position: absolute;
  z-index: 4;
  top: clamp(1.25rem, 3.5vw, 3rem);
  right: clamp(1.25rem, 3.5vw, 3rem);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  pointer-events: none;
}

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

  .word {
    bottom: 26%;
    font-size: 29vw;
  }

  .floor {
    bottom: calc(26% - 0.25rem);
  }

  .controls {
    right: 1.25rem;
  }

  .controls button {
    flex: 1;
  }

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

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

  .letter {
    transform: none !important;
  }
}
