:root {
  color-scheme: dark;
  --ink: #f4f7ef;
  --muted: rgba(227, 238, 228, 0.58);
  --line: rgba(224, 240, 226, 0.18);
  --glass: rgba(3, 10, 11, 0.68);
  --accent: #8df5cf;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.experience {
  position: relative;
  width: 100vw;
  height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background: #030708;
  cursor: crosshair;
}

#aurora {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.sky-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.09;
  background-image:
    repeating-radial-gradient(circle at 17% 23%, rgba(255, 255, 255, 0.35) 0 0.4px, transparent 0.6px 4px),
    repeating-radial-gradient(circle at 72% 61%, rgba(255, 255, 255, 0.25) 0 0.3px, transparent 0.5px 5px);
  background-size: 7px 9px, 11px 13px;
  mix-blend-mode: soft-light;
}

/* Chromium repaints backdrop filters over an animated canvas very expensively. */
.chromium-renderer .sky-grain {
  opacity: 0.035;
  mix-blend-mode: normal;
}

.chromium-renderer .text-button,
.chromium-renderer .round-button,
.chromium-renderer .clear-button,
.chromium-renderer .new-auroras-button,
.chromium-renderer .composer,
.chromium-renderer .reveal-interface {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chromium-renderer .text-button,
.chromium-renderer .round-button,
.chromium-renderer .clear-button,
.chromium-renderer .new-auroras-button {
  background: rgba(4, 12, 12, 0.82);
}

.chromium-renderer .composer {
  background: rgba(3, 10, 11, 0.9);
}

.masthead {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 34px;
  pointer-events: none;
}

.brand,
.header-actions,
.composer {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(220, 255, 235, 0.72);
  border-radius: 50%;
  box-shadow: inset 5px 0 0 rgba(118, 255, 214, 0.22), 0 0 20px rgba(118, 255, 214, 0.16);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-button,
.round-button,
.clear-button {
  border: 1px solid var(--line);
  background: rgba(4, 12, 12, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

.text-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: border-color 180ms ease, background 180ms ease;
}

.text-button:hover,
.round-button:hover {
  border-color: rgba(141, 245, 207, 0.58);
  background: rgba(12, 31, 28, 0.62);
}

.round-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.sound-pulse {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 14px;
  height: 12px;
}

.sound-pulse i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: center;
}

.sound-pulse i:nth-child(2) {
  height: 8px;
}

.record-dot {
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 155, 151, 0.9);
  border-radius: 50%;
  background: rgba(255, 105, 94, 0.24);
  box-shadow: 0 0 9px rgba(255, 105, 94, 0.24);
}

#recordButton.is-recording {
  border-color: rgba(255, 137, 128, 0.62);
}

#recordButton.is-recording .record-dot {
  background: #ff6b61;
  box-shadow: 0 0 13px rgba(255, 107, 97, 0.72);
  animation: record-pulse 900ms ease-in-out infinite alternate;
}

#recordButton:disabled {
  cursor: wait;
  opacity: 0.82;
}

@keyframes record-pulse {
  to { transform: scale(1.45); opacity: 0.58; }
}

.text-button[aria-pressed="true"] .sound-pulse i {
  animation: sound-wave 900ms ease-in-out infinite alternate;
}

.text-button[aria-pressed="true"] .sound-pulse i:nth-child(2) {
  animation-delay: -300ms;
}

.text-button[aria-pressed="true"] .sound-pulse i:nth-child(3) {
  animation-delay: -600ms;
}

@keyframes sound-wave {
  to { transform: scaleY(2.2); }
}

.intro {
  position: absolute;
  z-index: 2;
  left: clamp(28px, 6vw, 96px);
  top: 50%;
  transform: translateY(-55%);
  max-width: 620px;
  pointer-events: none;
  transition: transform 700ms ease;
}

.experience.has-created .intro {
  transform: translateY(-52%) translateX(-12px);
}

.intro > .eyebrow,
.intro h1,
.intro .instruction {
  transition: opacity 700ms ease;
}

.experience.has-created .intro > .eyebrow,
.experience.has-created .intro h1,
.experience.has-created .intro .instruction {
  opacity: 0.18;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 620px;
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(58px, 8.2vw, 132px);
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: -0.055em;
  text-wrap: balance;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.3);
}

h1 em {
  color: rgba(224, 246, 233, 0.84);
  font-weight: 400;
}

.instruction {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 34px 0 0;
  color: rgba(235, 244, 236, 0.68);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gesture-line {
  display: inline-block;
  width: 38px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: breathe 2.2s ease-in-out infinite;
}

.new-auroras-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 11px 16px 10px;
  border: 1px solid rgba(141, 245, 207, 0.34);
  border-radius: 999px;
  background: rgba(4, 13, 13, 0.46);
  color: rgba(239, 249, 241, 0.82);
  box-shadow: 0 0 28px rgba(141, 245, 207, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.new-auroras-button span {
  color: var(--accent);
  font-size: 14px;
  line-height: 0;
}

.new-auroras-button:hover {
  border-color: rgba(141, 245, 207, 0.72);
  background: rgba(10, 30, 27, 0.64);
  color: var(--ink);
  transform: translateY(-2px);
}

@keyframes breathe {
  50% { opacity: 0.35; transform: scaleX(0.7); }
}

.composer {
  position: absolute;
  z-index: 4;
  right: 34px;
  bottom: 30px;
  width: min(318px, calc(100vw - 40px));
  max-height: calc(100svh - 100px);
  padding: 20px;
  border: 1px solid rgba(220, 243, 228, 0.15);
  border-radius: 2px;
  background: var(--glass);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  cursor: default;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(141, 245, 207, 0.25) transparent;
}

.composer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 20px;
  width: 52px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.composer-heading,
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.composer-heading {
  margin-bottom: 20px;
}

.composer-heading .eyebrow {
  margin: 0 0 5px;
}

.composition-name {
  margin: 0;
  font-family: Iowan Old Style, Baskerville, serif;
  font-size: 21px;
}

.clear-button {
  padding: 8px 0 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.clear-button:hover {
  color: var(--ink);
}

.control-row {
  margin: 13px 0 8px;
  color: rgba(239, 247, 240, 0.74);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.control-row output,
.control-row > span:last-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

select {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 11px;
  border: 1px solid rgba(220, 243, 228, 0.14);
  border-radius: 2px;
  appearance: none;
  color: rgba(239, 247, 240, 0.84);
  background:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%) calc(100% - 14px) 14px / 4px 4px no-repeat,
    linear-gradient(135deg, var(--accent) 50%, transparent 50%) calc(100% - 10px) 14px / 4px 4px no-repeat,
    rgba(255, 255, 255, 0.035);
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  height: 14px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: linear-gradient(90deg, var(--accent) var(--range-position, 50%), var(--line) var(--range-position, 50%));
}

input[type="range"]::-moz-range-track {
  height: 1px;
  background: var(--line);
}

input[type="range"]::-moz-range-progress {
  height: 1px;
  background: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  margin-top: -4.5px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: #07100f;
  box-shadow: 0 0 12px rgba(141, 245, 207, 0.42);
}

input[type="range"]::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: #07100f;
}

.palette-section {
  margin-top: 17px;
  padding-top: 2px;
  border-top: 1px solid rgba(220, 243, 228, 0.1);
}

.palettes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.palette {
  position: relative;
  height: 30px;
  display: flex;
  align-items: stretch;
  padding: 3px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease;
}

.palette:hover {
  transform: translateY(-2px);
}

.palette.is-active {
  border-color: rgba(232, 255, 243, 0.68);
}

.palette span {
  flex: 1;
  background: var(--swatch);
  box-shadow: 0 0 13px var(--swatch);
}

.palette span:first-child {
  border-radius: 999px 0 0 999px;
}

.palette span:last-child {
  border-radius: 0 999px 999px 0;
}

.shifting-palette span {
  animation: spectrum-shift 8s linear infinite;
}

.atmosphere-controls {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid rgba(220, 243, 228, 0.1);
}

.atmosphere-controls summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(239, 247, 240, 0.76);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.atmosphere-controls summary::-webkit-details-marker {
  display: none;
}

.summary-hint {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.atmosphere-controls[open] .summary-hint {
  color: var(--accent);
}

.atmosphere-body {
  padding-top: 5px;
}

.sky-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
}

.sky-toggles label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(220, 243, 228, 0.11);
  color: rgba(239, 247, 240, 0.68);
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
}

.sky-toggles input {
  width: 11px;
  height: 11px;
  margin: 0;
  accent-color: var(--accent);
}

@keyframes spectrum-shift {
  to { filter: hue-rotate(360deg); }
}

.coordinate {
  position: absolute;
  z-index: 2;
  left: 34px;
  bottom: 30px;
  color: rgba(226, 243, 232, 0.7);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.21em;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(141, 245, 207, 0.16);
  pointer-events: auto;
  transition: color 180ms ease, text-shadow 180ms ease;
}

.coordinate:hover {
  color: rgba(239, 255, 247, 0.95);
  text-shadow: 0 0 18px rgba(141, 245, 207, 0.32);
}

.masthead,
.intro,
.composer,
.coordinate {
  transition-property: opacity, transform;
  transition-duration: 520ms;
  transition-timing-function: ease;
}

.interface-hidden .masthead,
.interface-hidden .intro,
.interface-hidden .composer,
.interface-hidden .coordinate {
  opacity: 0;
  pointer-events: none;
}

.interface-hidden .masthead {
  transform: translateY(-12px);
}

.interface-hidden .composer {
  transform: translateY(14px);
}

.interface-hidden .intro {
  transform: translateY(-55%) translateX(-16px);
}

.gallery-mode:not(.interface-hidden) .masthead,
.gallery-mode:not(.interface-hidden) .composer {
  opacity: 0.14;
}

.gallery-mode:not(.interface-hidden) .intro {
  opacity: 0.08;
}

.gallery-mode:not(.interface-hidden) .coordinate {
  opacity: 0.38;
}

.reveal-interface {
  position: absolute;
  z-index: 8;
  top: 22px;
  right: 24px;
  padding: 9px 13px;
  border: 1px solid rgba(220, 243, 228, 0.18);
  border-radius: 999px;
  background: rgba(3, 10, 11, 0.48);
  color: rgba(232, 246, 236, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
  transition: opacity 300ms ease, transform 300ms ease, color 180ms ease;
}

.interface-hidden .reveal-interface {
  opacity: 0.46;
  pointer-events: auto;
  transform: translateY(0);
}

.interface-hidden .reveal-interface:hover {
  opacity: 1;
  color: var(--ink);
}

.exhibition-mode {
  cursor: none;
}

.exhibition-mode .reveal-interface {
  opacity: 0.2;
  cursor: pointer;
}

.cursor-aura {
  position: absolute;
  z-index: 5;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border: 1px solid rgba(141, 245, 207, 0.42);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  contain: strict;
  will-change: transform;
  box-shadow: inset 0 0 18px rgba(141, 245, 207, 0.08), 0 0 24px rgba(141, 245, 207, 0.08);
  transition: width 180ms ease, height 180ms ease, margin 180ms ease, opacity 180ms ease;
}

.experience.is-hovering .cursor-aura {
  opacity: 1;
}

.experience.is-drawing .cursor-aura {
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
  border-color: rgba(141, 245, 207, 0.78);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .masthead {
    padding: 20px;
  }

  .intro {
    left: 24px;
    top: 38%;
  }

  h1 {
    font-size: clamp(48px, 16vw, 78px);
  }

  .composer {
    right: 20px;
    bottom: 20px;
    width: calc(100vw - 40px);
    padding: 16px;
  }

  .coordinate {
    display: none;
  }
}

@media (max-width: 600px) {
  .header-actions {
    gap: 6px;
  }

  #recordButton,
  #soundButton {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  #recordLabel,
  #soundLabel {
    display: none;
  }

  .round-button {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 480px) {
  .brand {
    max-width: 22px;
    overflow: hidden;
  }

  .text-button {
    padding: 0 12px;
  }

  .intro {
    top: 32%;
  }

  .instruction {
    margin-top: 24px;
    font-size: 9px;
  }
}

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