:root {
  --field: #edf3ec;
  --ink: #122a3f;
  --muted: #5f6d70;
  --coral: #ff6148;
  --blue: #2856df;
  --acid: #c9ee4a;
  --paper: rgba(248, 251, 245, .92);
  --line: rgba(18, 42, 63, .22);
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--field);
  color: var(--ink);
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button,
a { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

[hidden] { display: none !important; }

.app {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
  background:
    radial-gradient(circle at 72% 24%, rgba(255,255,255,.7), transparent 26%),
    linear-gradient(115deg, rgba(40,86,223,.035), transparent 42%),
    var(--field);
}

.app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .17;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='110' viewBox='0 0 110 110'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

#score {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.mast {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  pointer-events: none;
}

.identity,
.utility { pointer-events: auto; }

.identity h1 {
  margin: 3px 0 0;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 620;
  letter-spacing: -.045em;
}

.date,
.eyebrow {
  margin: 0;
  font-size: .64rem;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.date { color: var(--muted); }

.utility {
  display: flex;
  gap: 7px;
}

.utility-button,
.coach button,
.voice-key {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(18, 42, 63, .33);
  border-radius: 100px;
  background: rgba(237, 243, 236, .78);
  font: 700 .69rem/1 inherit;
  letter-spacing: .04em;
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.utility-button:hover,
.coach button:hover,
.voice-key:hover { background: #fff; }

.panel {
  position: fixed;
  z-index: 12;
  border: 1px solid rgba(18, 42, 63, .3);
  background: var(--paper);
  box-shadow: 0 26px 70px rgba(18, 42, 63, .12);
  backdrop-filter: blur(20px);
}

.intro {
  left: clamp(20px, 6vw, 88px);
  bottom: clamp(24px, 8vh, 84px);
  width: min(620px, calc(100vw - 40px));
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.intro h2,
.between h2,
.finale h2 {
  margin: 16px 0 18px;
  max-width: 15ch;
  font-size: clamp(2.35rem, 4.35vw, 4.85rem);
  font-weight: 510;
  line-height: .91;
  letter-spacing: -.065em;
}

.lede {
  max-width: 47ch;
  margin: 0 0 26px;
  color: #354c58;
  font-size: clamp(.98rem, 1.45vw, 1.2rem);
  line-height: 1.45;
}

.quiet {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.4;
}

.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  width: min(100%, 360px);
  min-height: 54px;
  padding: 0 19px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: #f8fbf5;
  font: 700 .76rem/1 inherit;
  letter-spacing: .045em;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease;
}

.primary:hover {
  transform: translateY(-2px);
  background: var(--blue);
}

.help {
  top: clamp(84px, 12vh, 130px);
  right: max(20px, env(safe-area-inset-right));
  width: min(390px, calc(100vw - 40px));
  padding: 25px;
}

.help p:not(.eyebrow) {
  margin: 18px 0;
  color: #354c58;
  font-size: .9rem;
  line-height: 1.52;
}

.close-help { padding: 0 18px; }

.movement {
  position: fixed;
  z-index: 7;
  top: 94px;
  left: max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: flex-start;
  gap: 30px;
  pointer-events: none;
}

.movement h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 2.5vw, 2.5rem);
  font-weight: 520;
  letter-spacing: -.045em;
}

.measure {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: baseline;
  color: var(--coral);
  font-size: clamp(1.7rem, 3vw, 3rem);
  font-weight: 760;
  letter-spacing: -.07em;
}

.measure small {
  grid-column: 1 / -1;
  margin-top: 1px;
  color: var(--muted);
  font-size: .58rem;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.voice-keys {
  position: fixed;
  z-index: 9;
  right: max(20px, env(safe-area-inset-right));
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(-50%);
}

.voice-key {
  position: relative;
  width: 46px;
  height: 46px;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  border: 0;
  border-bottom: 3px solid var(--voice-color, var(--blue));
  border-radius: 1px;
  background: rgba(237, 243, 236, .58);
}

.voice-key::before {
  display: none;
}

.voice-key span { position: relative; z-index: 1; }

.voice-key[aria-pressed="true"] {
  background: var(--voice-color, var(--coral));
  transform: scale(.93);
}

.voice-key.joined {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.voice-key.joined::before { border-color: var(--acid); }

.coach {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 7px 7px 7px 12px;
  border: 0;
  border-radius: 0;
  background: rgba(248, 251, 245, .72);
  box-shadow: none;
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.coach p {
  margin: 0;
  white-space: nowrap;
  color: #425761;
  font-size: .74rem;
  font-weight: 650;
}

.coach button {
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid var(--coral);
  border-radius: 0;
  background: transparent;
  color: #9c241a;
}

.between {
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 40px));
  padding: clamp(26px, 5vw, 50px);
  transform: translate(-50%, -50%);
}

.between h2 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 5vw, 5rem);
}

.between > p:not(.eyebrow) {
  max-width: 42ch;
  margin: 0 0 25px;
  color: var(--muted);
  line-height: 1.45;
}

.finale {
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: auto;
  padding: clamp(26px, 5vw, 68px);
  border: 0;
  background: linear-gradient(90deg, rgba(237,243,236,.97) 0, rgba(237,243,236,.78) 30%, rgba(237,243,236,0) 67%);
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

.finale > * { pointer-events: auto; }

.finale h2 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 4.6vw, 5rem);
}

.finale-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.home-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: .75rem;
  font-weight: 750;
  text-underline-offset: 4px;
}

.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;
}

.app[data-state="playing"] .intro { display: none; }

.app[data-state="bloom"] .mast,
.app[data-state="between"] .mast,
.app[data-state="finale"] .mast { color: var(--ink); }

@media (max-width: 680px) {
  .mast { padding-top: max(14px, env(safe-area-inset-top)); }

  .date { display: none; }

  .identity h1 { margin-top: 8px; }

  .intro {
    left: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    max-height: calc(100svh - 84px);
    padding: 0 24px 18px;
  }

  .intro h2 { font-size: clamp(2.5rem, 10.8vw, 3.8rem); }

  .quiet { display: none; }

  .movement {
    top: 78px;
    left: 16px;
    right: 16px;
    justify-content: space-between;
  }

  .movement h2 { font-size: 1.2rem; }

  .measure { font-size: 1.65rem; }

  .voice-keys {
    top: auto;
    right: 50%;
    bottom: max(72px, calc(env(safe-area-inset-bottom) + 62px));
    flex-direction: row;
    gap: 5px;
    transform: translateX(50%);
  }

  .voice-key {
    width: 44px;
    height: 44px;
  }

  .coach {
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }

  .coach p {
    max-width: 56vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .between,
  .between {
    left: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    top: auto;
    width: calc(100vw - 24px);
    padding: 25px;
    transform: none;
  }

  .between h2,
  .finale h2 { font-size: clamp(2.65rem, 11vw, 4rem); }

  .finale {
    inset: 0;
    width: auto;
    padding: 24px 24px max(30px, env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(237,243,236,.99) 0, rgba(237,243,236,.92) 42%, rgba(237,243,236,0) 76%);
  }

  .finale h2 {
    max-width: 10ch;
    font-size: clamp(2.55rem, 10.4vw, 3.8rem);
  }

  .finale .lede { font-size: .88rem; }
}

@media (max-height: 700px) and (min-width: 681px) {
  .intro { bottom: 24px; padding: 26px 32px; }
  .intro h2 { font-size: 3.4rem; }
  .quiet { display: none; }
  .movement { top: 74px; }
}

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