:root {
  color-scheme: dark;
  --background: #263cff;
  --foreground: #fff;
  --footer-font-size: clamp(9px, 1vw, 11px);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: "Helvetica Neue", Arial, sans-serif;
  transition: background-color 180ms ease-out, color 140ms linear;
}
#stage { position: fixed; inset: 0; overflow: hidden; }
.squiggle {
  position: absolute; inset: 0 auto auto 0;
  width: min(58vw, 60vh, 660px);
  padding: 0; border: 0; background: none;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.squiggle.dragging { cursor: grabbing; }
.squiggle img {
  display: block; width: 100%; height: auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 5px #15002024);
}
#spectrum {
  display: none; position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.squiggle.spectrum-ready #spectrum { display: block; }
.squiggle.spectrum-ready img { visibility: hidden; }
button:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
.site-footer {
  position: fixed; z-index: 2;
  inset: auto max(20px, env(safe-area-inset-right))
    max(9px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; pointer-events: none;
  font-size: var(--footer-font-size); line-height: 1.2;
}
.site-credit {
  display: flex; align-items: center; gap: 8px;
  letter-spacing: .015em; white-space: nowrap;
}
.site-credit a { color: inherit; pointer-events: auto; text-decoration: none; }
.site-credit a:hover, .site-credit a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.separator { width: 1px; height: 10px; background: currentColor; opacity: .7; }
.sound {
  display: grid; place-items: center; width: 34px; height: 44px; padding: 0;
  background: none; border: 0; color: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sound .on,.sound[aria-pressed="true"] .off { display: none; }
.sound[aria-pressed="true"] .on { display: initial; }
@media (max-width: 650px) { .squiggle { width: min(66vw, 55vh); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.squiggle { aspect-ratio: var(--artwork-ratio, 838 / 645); }
.squiggle > img { position: absolute; inset: 0; height: 100%; object-fit: contain; }
#spectrum { object-fit: contain; }
.squiggle > img, #spectrum, .original { transition: opacity 280ms ease; }
.squiggle.show-original > img, .squiggle.show-original #spectrum { opacity: 0; }
.original {
  position: absolute; inset: 0; overflow: hidden; opacity: 0; pointer-events: none;
}
.original canvas { display: block; width: 100%; height: 100%; }
.squiggle.show-original .original { opacity: 1; }

.finder {
  position: relative; display: flex; align-items: center;
  pointer-events: auto;
}
.finder form { display: flex; align-items: center; }
.finder input, .finder button {
  color: inherit; background: transparent; font: inherit; border: 0;
}
.finder input { width: 76px; height: 44px; padding: 0 2px; }
.finder input::placeholder { color: inherit; opacity: .86; }
.finder button, .finder summary { cursor: pointer; }
.finder form button, .finder summary {
  display: grid; place-items: center; width: 28px; height: 44px; padding: 0;
}
.finder summary { list-style: none; }
.finder summary::-webkit-details-marker { display: none; }
.finder-actions { position: relative; }
.finder-menu {
  position: absolute; bottom: 100%; right: 0;
  display: grid; min-width: 82px; padding: 3px 0;
  background: var(--background);
  border-radius: 6px; box-shadow: 0 2px 12px #0002;
}
.finder-menu button { min-height: 36px; padding: 0 12px; text-align: left; white-space: nowrap; }
.finder-menu button:hover { text-decoration: underline; text-underline-offset: 3px; }
.finder-status {
  position: absolute; bottom: 100%; left: 0; width: max-content; max-width: calc(100vw - 36px);
  margin: 0 0 5px; pointer-events: none;
}

@media (max-width: 550px) {
  .site-footer {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(7px, env(safe-area-inset-bottom));
    gap: 4px;
  }
  .site-credit { gap: 5px; letter-spacing: 0; }
  .finder .sound { width: 28px; }
  .finder input { width: 54px; }
  .finder input:focus { font-size: 16px; }
  .finder form button, .finder summary { width: 22px; }
}
.squiggle.show-original { width: min(58vw, 660px, var(--artwork-height-limit)); }
@media (max-width: 650px) {
  .squiggle.show-original { width: min(72vw, var(--artwork-height-limit)); }
}
