@font-face {
  font-family: "Switzer";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src:
    local("Switzer Variable"),
    local("Switzer"),
    url("assets/fonts/Switzer-Variable.ttf") format("truetype");
}

@font-face {
  font-family: "Switzer";
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src:
    local("Switzer Variable Italic"),
    local("Switzer Italic"),
    url("assets/fonts/Switzer-VariableItalic.ttf") format("truetype");
}

:root {
  color-scheme: light;
  --ink: #1d2720;
  --page-bg: #97b092;
  --painting-ratio: 2783 / 1381;
  --tile-gap: 0px;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  background: var(--page-bg);
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family:
    Switzer, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  overflow: hidden;
}

button {
  font: inherit;
}

.app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 80px);
  background: var(--page-bg);
}

.orientation-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  align-content: center;
  gap: 22px;
  padding: 28px;
  color: rgba(255, 255, 255, 0.92);
  background: #000000;
  text-align: center;
}

.orientation-gate p {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.orientation-gate__note {
  max-width: 240px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.25;
}

.orientation-gate__lottie {
  width: min(42vw, 180px);
  height: min(42vw, 180px);
  display: block;
}

.stage {
  width: min(72vw, 1380px, 116.88dvh);
  display: grid;
  gap: clamp(10px, 1.8dvh, 18px);
  transform: translateY(14px);
}

.editorial-title {
  position: fixed;
  top: clamp(18px, 3vw, 34px);
  left: 50%;
  z-index: 25;
  width: min(72vw, 1380px, 116.88dvh);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(24px, 5vw, 82px);
  align-items: start;
  padding: 0 2px;
  color: rgba(255, 255, 255, 0.96);
  font-family:
    Switzer, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: clamp(13px, 1.12vw, 18px);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.12;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.editorial-title span {
  min-width: 0;
}

.editorial-title span:last-child {
  color: rgba(255, 255, 255, 0.84);
  font-size: inherit;
  font-weight: inherit;
  justify-self: end;
  letter-spacing: inherit;
  text-align: right;
}

.upload-trigger {
  min-width: 128px;
  text-transform: none;
}

.sound-primer {
  margin: 0 0 -4px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0;
  line-height: 1;
  pointer-events: none;
  text-align: center;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.app.is-audio-ready .sound-primer {
  opacity: 0;
  transform: translateY(-3px);
}

.mosaic {
  --grid-cols: 8;
  --grid-rows: 5;
  --bg-width: 800%;
  --bg-height: 500%;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--grid-rows), minmax(0, 1fr));
  gap: var(--tile-gap);
  padding: var(--tile-gap);
  width: 100%;
  aspect-ratio: var(--painting-ratio);
  height: auto;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--page-bg);
  perspective: 1200px;
  position: relative;
  overflow: visible;
}

.waveform {
  width: 100%;
  height: clamp(54px, 7.8dvh, 84px);
  display: block;
  cursor: pointer;
  opacity: 0.78;
  touch-action: none;
  transition: opacity 240ms ease;
}

.app.is-playing .waveform {
  opacity: 1;
}

.controls-area {
  position: relative;
  display: grid;
  justify-items: center;
  min-height: 80px;
}

.cheatsheet-panel {
  position: absolute;
  top: 60px;
  left: 50%;
  width: min(100%, 760px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, -4px);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 180ms ease;
  visibility: hidden;
}

.cheatsheet-panel span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.cheatsheet-panel strong {
  color: #ffffff;
  font-weight: 650;
}

.app.is-cheatsheet-visible .cheatsheet-panel {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}

.tile {
  --accent: #74a9d2;
  --brightness: 1;
  --saturation: 1;
  --brightness-pos: 0.5;
  --saturation-pos: 0.45;
  --drag-x: 0px;
  --drag-y: 0px;
  --gesture-x: 45.3%;
  --gesture-y: 51.5%;
  --hover-lift-x: 0px;
  --hover-lift-y: 0px;
  --hover-rotate-x: 0deg;
  --hover-rotate-y: 0deg;
  --hover-scale: 1;
  --hover-z: 0px;
  position: relative;
  display: block;
  width: calc(100% + 1px);
  height: calc(100% + 1px);
  min-width: 0;
  min-height: 0;
  margin-right: -1px;
  margin-bottom: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  isolation: isolate;
  cursor: pointer;
  background: #a8cbdc;
  box-shadow: none;
  touch-action: none;
  user-select: none;
  transform: translate3d(
      calc(var(--drag-x) + var(--hover-lift-x)),
      calc(var(--drag-y) + var(--hover-lift-y)),
      var(--hover-z)
    )
    rotateX(var(--hover-rotate-x))
    rotateY(var(--hover-rotate-y))
    scale(var(--hover-scale));
  transform-style: preserve-3d;
  transition:
    opacity 160ms ease,
    box-shadow 520ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.tile:hover {
  z-index: 2;
}

.tile.is-dragging {
  cursor: grabbing;
  opacity: 0.94;
  z-index: 10;
  transition: none;
}

.tile.is-playing {
  z-index: 1;
}

.tile.is-hovered {
  z-index: 6;
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.34),
    0 0 34px rgba(255, 255, 255, 0.24),
    0 0 68px rgba(255, 255, 255, 0.14),
    0 18px 42px rgba(0, 0, 0, 0.36);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.34),
    0 0 34px color-mix(in srgb, var(--accent) 44%, rgba(255, 255, 255, 0.32)),
    0 0 68px color-mix(in srgb, var(--accent) 30%, transparent),
    0 18px 42px rgba(0, 0, 0, 0.36);
}

.tile.is-dragging {
  --hover-lift-x: 0px;
  --hover-lift-y: 0px;
  --hover-rotate-x: 0deg;
  --hover-rotate-y: 0deg;
  --hover-scale: 1.035;
  --hover-z: 28px;
  z-index: 10;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0 solid transparent;
  pointer-events: none;
}

.tile:hover::after {
  border-width: 0;
  box-shadow:
    inset 0 0 22px rgba(255, 255, 255, 0.22),
    inset 0 0 2px rgba(255, 255, 255, 0.34);
}

.tile.is-playing::after {
  border-width: 0;
  box-shadow: none;
}

.tile:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  z-index: 3;
}

.tile__image {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("assets/painting.jpg");
  background-repeat: no-repeat;
  background-size: var(--bg-width) var(--bg-height);
  background-position: var(--x) var(--y);
  filter: none;
  transform: none;
  transition: none;
}

.tile__sound-label {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  z-index: 5;
  display: grid;
  gap: 2px;
  padding: 4px 5px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(0, 0, 0, 0.58);
  font-size: clamp(7px, 0.58vw, 10px);
  line-height: 1.05;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.tile__sound-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile__sound-label span:first-child {
  color: var(--accent);
  font-weight: 700;
}

.app.is-sound-map-visible .tile__sound-label {
  opacity: 1;
}

.pitch-labels {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -98px;
  z-index: 8;
  display: grid;
  grid-template-rows: repeat(var(--grid-rows), minmax(0, 1fr));
  width: 88px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  text-align: right;
  text-transform: uppercase;
  transform: translateX(-5px);
  transition:
    opacity 180ms ease,
    transform 220ms ease;
}

.pitch-labels span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.pitch-labels span::after {
  content: "";
  width: 10px;
  height: 1px;
  margin-left: 7px;
  background: rgba(255, 255, 255, 0.34);
}

.app.is-cheatsheet-visible .pitch-labels {
  opacity: 1;
  transform: translateX(0);
}

.tile.is-edited .tile__image {
  filter: brightness(var(--brightness)) saturate(var(--saturation));
}

.tile:hover .tile__image {
  transform: none;
}

.tile__gesture {
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.tile.is-tuning .tile__gesture {
  opacity: 1;
}

.tile__gesture-dot {
  position: absolute;
  left: var(--gesture-x);
  top: var(--gesture-y);
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.68),
    0 0 18px color-mix(in srgb, var(--accent) 48%, transparent);
  transform: translate(-50%, -50%);
}

.playhead {
  position: absolute;
  top: var(--tile-gap);
  bottom: var(--tile-gap);
  left: var(--playhead-left, var(--tile-gap));
  z-index: 5;
  width: var(--playhead-width, 0px);
  border-left: 2px solid rgba(255, 255, 255, 0.92);
  border-right: 2px solid rgba(255, 255, 255, 0.92);
  opacity: 0;
  pointer-events: none;
  transition:
    left 120ms linear,
    opacity 180ms ease,
    width 120ms linear;
}

.app.is-playing .playhead,
.app.has-playhead .playhead {
  opacity: 1;
}

.transport-bar {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
  transform: translateY(-18px);
}

.transport-side {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.transport-side--left {
  justify-self: end;
  justify-content: flex-end;
}

.transport-side--right {
  justify-self: start;
  justify-content: flex-start;
}

.transport--play {
  justify-self: center;
}

.transport {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  cursor: pointer;
}

.mode-toggle {
  min-width: 76px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.transport:hover,
.mode-toggle:hover {
  border-color: rgba(255, 255, 255, 0.74);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.mode-toggle[aria-pressed="true"] {
  border-color: rgba(99, 129, 83, 0.9);
  color: #ffffff;
  background: rgba(99, 129, 83, 0.32);
  box-shadow: 0 0 24px rgba(99, 129, 83, 0.22);
}

.transport:focus-visible,
.mode-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

.upload-popover {
  position: absolute;
  top: var(--upload-popover-top, 0px);
  left: var(--upload-popover-left, 50%);
  z-index: 30;
  width: min(92vw, 340px);
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  color: #ffffff;
  background: rgba(105, 128, 99, 0.72);
  box-shadow: 0 18px 46px rgba(20, 35, 22, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 6px));
  transition:
    opacity 160ms ease,
    transform 190ms ease,
    visibility 160ms ease;
  visibility: hidden;
  backdrop-filter: blur(16px);
}

.upload-popover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, calc(-100% - 12px));
  visibility: visible;
}

.upload-popover::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(105, 128, 99, 0.72);
  transform: translateX(-50%) rotate(45deg);
}

.upload-popover p {
  margin: 0;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.waitlist-form {
  display: grid;
  gap: 0;
}

.waitlist-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.waitlist-form input,
.waitlist-form button {
  height: 36px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
}

.waitlist-form input {
  min-width: 0;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.waitlist-form input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.waitlist-form button {
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  color: #5f7659;
  background: #ffffff;
  cursor: pointer;
  font-weight: 650;
}

.waitlist-form button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.waitlist-form__status {
  display: none;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
}

.waitlist-form__status:not(:empty) {
  display: block;
}

.waitlist-form.is-complete .waitlist-form__row {
  display: none;
}

.waitlist-form.is-complete .waitlist-form__status {
  margin-top: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.transport__icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  vector-effect: non-scaling-stroke;
}

.transport__icon--play {
  fill: currentColor;
  stroke: none;
}

.transport__icon--shuffle {
  width: 20px;
  height: 20px;
}

.transport__icon--reset {
  width: 19px;
  height: 19px;
}

.transport__icon--pause,
.app.is-playing .transport__icon--play {
  display: none;
}

.app.is-playing .transport__icon--pause {
  display: block;
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
  body {
    overflow: hidden;
  }

  .orientation-gate {
    display: grid;
  }

  .stage,
  .editorial-title {
    visibility: hidden;
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  html,
  body {
    height: auto;
    min-height: 124dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    -webkit-overflow-scrolling: touch;
  }

  .app {
    position: relative;
    inset: auto;
    min-height: 124dvh;
    align-content: start;
    padding: 6px clamp(6px, 1.6dvw, 12px) 26dvh;
    place-items: start center;
  }

  .stage {
    width: min(88vw, 176dvh);
    gap: clamp(5px, 1.25dvh, 8px);
    margin-top: 24px;
    transform: translateY(0);
  }

  .editorial-title {
    top: 8px;
    width: min(88vw, 176dvh);
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    font-size: 10px;
    letter-spacing: 0;
  }

  .upload-trigger {
    min-width: 104px;
  }

  .editorial-title span:last-child {
    letter-spacing: 0;
  }

  .mosaic {
    aspect-ratio: var(--painting-ratio);
    height: auto;
  }

  .waveform {
    height: clamp(24px, 7dvh, 36px);
  }

  .controls-area {
    min-height: 58px;
  }

  #cheatsheetToggle,
  #soundMapToggle,
  .cheatsheet-panel {
    display: none;
  }

  .tile__sound-label,
  .pitch-labels {
    display: none;
  }

  .transport-bar {
    column-gap: 9px;
    transform: translateY(-8px);
  }

  .transport-side {
    gap: 9px;
  }

  .transport {
    width: 34px;
    height: 34px;
  }

  .mode-toggle {
    min-width: 62px;
    height: 30px;
    padding: 0 10px;
    font-size: 10px;
  }

  .transport__icon {
    width: 17px;
    height: 17px;
  }

  .transport__icon--shuffle {
    width: 18px;
    height: 18px;
  }

  .upload-popover {
    width: min(92vw, 300px);
    padding: 11px;
  }

  .waitlist-form__row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .waitlist-form input,
  .waitlist-form button {
    height: 32px;
    font-size: 10px;
  }

  .tile__gesture-dot {
    width: 8px;
    height: 8px;
  }

  .pitch-labels {
    left: 7px;
    width: 52px;
    font-size: 8px;
    text-align: left;
  }

  .pitch-labels span {
    justify-content: flex-start;
  }

  .pitch-labels span::after {
    display: none;
  }
}

@media (max-width: 960px) {
  .mosaic {
    --tile-gap: 0px;
  }
}

@media (max-width: 560px) {
  .mosaic {
    --tile-gap: 0px;
  }
}

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