:root {
  color-scheme: dark;
  --ink: #14110e;
  --paper: #f4efe6;
  --brass: #e0a15a;
  --mute: #a89884;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  touch-action: none;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

header {
  position: fixed;
  left: max(28px, 4vw);
  top: max(18px, 2.5vh);
  z-index: 1;
  pointer-events: none;
  transition: opacity 1.6s ease;
}

h1 {
  margin: 0;
  font-weight: 500;
  font-size: clamp(72px, 10vw, 140px);
  letter-spacing: -0.045em;
  line-height: 0.82;
  transition: font-size 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Once the sound is on, the title makes room for the picture. */
body.playing h1 { font-size: clamp(40px, 4.2vw, 64px); }
body.quiet header { opacity: 0.3; }
body.quiet #bar { opacity: 0.14; }
body.quiet #bar:hover { opacity: 1; }

header p {
  margin: 0.35em 0 0 0.15em;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

#bar {
  position: fixed;
  top: max(18px, 2.5vh);
  right: max(22px, 3vw);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35em 0.9em;
  align-items: center;
  max-width: min(980px, 72vw);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 560;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 10px rgba(20, 17, 14, 0.9);
  transition: opacity 1.6s ease;
}

#bar .field { display: flex; align-items: center; gap: 0.45em; color: var(--mute); }
#bar select, #bar input, #bar button {
  appearance: none;
  background: transparent;
  color: var(--paper);
  border: 0;
  border-bottom: 1px solid rgba(244, 239, 230, 0.35);
  border-radius: 0;
  padding: 0.35em 0.1em 0.28em;
  font: inherit;
  letter-spacing: 0.04em;
}
#bar select { max-width: 11em; cursor: pointer; }
#bar input { width: 8em; }
#bar input::placeholder { color: rgba(244, 239, 230, 0.35); }
#bar button { cursor: pointer; color: var(--brass); }
#bar button:hover, #bar select:hover, #bar input:hover { border-bottom-color: var(--brass); }
#bar button:focus-visible, #bar select:focus-visible, #bar input:focus-visible {
  outline: none;
  border-bottom-color: var(--paper);
}
#midi {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

#start {
  position: fixed;
  inset: 0;
  z-index: 4;
  margin: 0;
  border: 0;
  background: rgba(20, 17, 14, 0.42);
  color: var(--paper);
  font: inherit;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.03em;
  cursor: pointer;
}
#start.gone { display: none; }

@media (max-width: 720px) {
  header { top: 14px; }
  h1, body.playing h1 { font-size: 52px; }
  #bar {
    top: 102px;
    right: 14px;
    left: 14px;
    max-width: none;
    justify-content: flex-start;
    row-gap: 0.15em;
  }
}

@media (prefers-reduced-motion: reduce) {
  header, #bar, h1 { transition: none; }
}
