:root {
  color-scheme: light;
  --forest: #0b6b53;
  --ink: #173c34;
  --muted: #58736a;
  --sand: #fff6d4;
  --sun: #ffb51b;
  --orange: #f08a16;
  --sky: #38b9d4;
  --coral: #ff6b4a;
  --violet: #8757d6;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #064738;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(4, 54, 43, .56), rgba(4, 54, 43, .84)),
    url("/assets/danca-dinossauro-cenario.webp") center / cover fixed;
  color: var(--ink);
  font-family: "Trebuchet MS", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

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

.stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  margin: 0 auto;
  background: var(--sky);
}

.scene {
  position: absolute;
  z-index: -4;
  inset: -1.5%;
  width: 103%;
  height: 103%;
  object-fit: cover;
  object-position: center center;
  transform: scale(1.01);
  transform-origin: 50% 68%;
  user-select: none;
  -webkit-user-drag: none;
}

.scene-shade {
  position: absolute;
  z-index: -3;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 80, 94, .55) 0%, rgba(4, 80, 94, .05) 24%, transparent 52%),
    linear-gradient(0deg, rgba(5, 53, 39, .5) 0%, rgba(5, 53, 39, .05) 34%, transparent 58%);
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: calc(13px + env(safe-area-inset-top)) 16px 0;
}

.utility-button,
.round-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 50%;
  background: rgba(9, 83, 67, .78);
  box-shadow: 0 8px 18px rgba(5, 52, 40, .22);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(9px);
  transition: transform 140ms var(--spring), background-color 220ms var(--ease), box-shadow 220ms var(--ease);
}

.utility-button:active,
.round-button:active,
.play-button:active {
  transform: scale(.91);
}

.utility-button:focus-visible,
.round-button:focus-visible,
.play-button:focus-visible,
#progress:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
}

.utility-button svg,
.round-button svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.sound-off,
.utility-button[aria-pressed="true"] .sound-on {
  display: none;
}

.utility-button[aria-pressed="true"] .sound-off {
  display: block;
}

.hero-copy {
  position: relative;
  z-index: 2;
  margin: 13px 18px 0;
  color: #fff;
  text-align: center;
  text-shadow: 0 3px 12px rgba(5, 59, 67, .42);
  transform-origin: 50% 0;
  transition: opacity 380ms var(--ease), transform 520ms var(--ease);
  animation: title-in 680ms 80ms both var(--ease);
}

.hero-copy p {
  margin: 0 0 3px;
  color: #fff3aa;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(2rem, 9.6vw, 3rem);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .84;
}

.hero-copy h1 span {
  display: inline-block;
  color: #fff1a4;
  font-size: 1.15em;
  -webkit-text-stroke: 1px rgba(113, 64, 9, .14);
}

.is-playing .hero-copy {
  opacity: .82;
  transform: translateY(-4px) scale(.94);
}

.air-notes {
  position: absolute;
  z-index: 1;
  inset: 12% 0 30%;
  pointer-events: none;
}

.air-note {
  position: absolute;
  opacity: 0;
  color: #fff3a0;
  font-family: Arial, sans-serif;
  font-size: 2rem;
  font-weight: 900;
  text-shadow: 0 4px 0 rgba(130, 80, 11, .18);
}

.note-one { left: 8%; top: 42%; color: #7cebd3; }
.note-two { right: 7%; top: 18%; color: #ffe265; font-size: 2.5rem; }
.note-three { right: 12%; top: 58%; color: #ff9c79; font-size: 1.7rem; }

.air-spark {
  position: absolute;
  width: 13px;
  height: 13px;
  opacity: 0;
}

.air-spark::before,
.air-spark::after {
  position: absolute;
  inset: 0 5px;
  border-radius: 99px;
  background: #fff;
  content: "";
}

.air-spark::after { transform: rotate(90deg); }
.spark-one { left: 15%; top: 28%; }
.spark-two { right: 18%; top: 42%; transform: scale(.7); }

.is-playing:not(.is-frozen):not(.is-paused) .scene {
  animation: stage-bop 1.04s infinite var(--ease);
}

.is-playing:not(.is-frozen):not(.is-paused) .air-note,
.is-playing:not(.is-frozen):not(.is-paused) .air-spark {
  animation: note-float 2.4s infinite var(--ease);
}

.is-playing:not(.is-frozen):not(.is-paused) .note-two { animation-delay: -.8s; }
.is-playing:not(.is-frozen):not(.is-paused) .note-three { animation-delay: -1.55s; }
.is-playing:not(.is-frozen):not(.is-paused) .spark-one { animation-delay: -.45s; }
.is-playing:not(.is-frozen):not(.is-paused) .spark-two { animation-delay: -1.35s; }

.player {
  position: absolute;
  z-index: 5;
  right: 12px;
  bottom: calc(35px + env(safe-area-inset-bottom));
  left: 12px;
  padding: 10px 13px 12px;
  border: 2px solid rgba(255, 255, 255, .84);
  border-radius: 29px 29px 23px 23px;
  background: linear-gradient(145deg, rgba(255, 253, 235, .97), rgba(255, 244, 199, .95));
  box-shadow: 0 22px 46px rgba(3, 50, 38, .35), inset 0 1px 0 #fff;
  backdrop-filter: blur(14px) saturate(1.1);
  animation: player-in 720ms 160ms both var(--spring);
}

.move-prompt {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  min-height: 68px;
  overflow: hidden;
  padding: 8px 12px 8px 8px;
  border: 2px solid rgba(31, 122, 89, .15);
  border-radius: 21px;
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 5px 0 rgba(153, 114, 45, .09);
  transition: background-color 300ms var(--ease), border-color 300ms var(--ease), transform 280ms var(--ease);
}

.move-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 17px;
  background: #dff7c6;
  color: var(--forest);
  transform: rotate(-4deg);
  transition: transform 300ms var(--spring), background-color 300ms var(--ease), color 300ms var(--ease);
}

.move-icon svg {
  grid-area: 1 / 1;
  width: 32px;
  height: 32px;
  fill: currentColor;
  transition: opacity 180ms var(--ease), transform 280ms var(--spring);
}

.icon-freeze {
  opacity: 0;
  transform: scale(.7) rotate(-8deg);
}

.prompt-content {
  min-width: 0;
  padding-left: 10px;
  transform-origin: 50% 50%;
  transition: opacity 160ms var(--ease), transform 200ms var(--ease);
}

.move-prompt.is-leaving .prompt-content {
  opacity: 0;
  transform: translateY(8px) rotateX(-5deg);
}

.move-prompt.is-entering .prompt-content {
  opacity: 0;
  transform: translateY(-8px) rotateX(5deg);
}

.move-label {
  display: block;
  margin-bottom: 2px;
  color: #3c7462;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .095em;
  line-height: 1;
  text-transform: uppercase;
}

.lyric-line {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(1rem, 4.8vw, 1.24rem);
  font-weight: 900;
  letter-spacing: -.025em;
  line-height: 1.05;
  text-overflow: ellipsis;
}

[data-mood="step"] .move-icon { background: #ffe59c; color: #b35d08; transform: rotate(5deg); }
[data-mood="stretch"] .move-icon { background: #d9d1ff; color: #6844bb; transform: rotate(-8deg) scale(1.04); }
[data-mood="story"] .move-icon { background: #c6f2ed; color: #087869; }

.is-frozen .move-prompt {
  border-color: rgba(27, 148, 176, .38);
  background: rgba(226, 251, 255, .95);
  transform: translateY(-2px);
}

.is-frozen .move-icon { background: var(--sky); color: #fff; transform: rotate(0); }
.is-frozen .icon-foot { opacity: 0; transform: scale(.7) rotate(8deg); }
.is-frozen .icon-freeze { opacity: 1; transform: scale(1) rotate(0); }
.is-frozen .move-label { color: #13728a; }

[data-mood="celebrate"] .move-prompt {
  border-color: rgba(255, 107, 74, .38);
  background: #fff1d2;
}

[data-mood="celebrate"] .move-icon {
  background: var(--coral);
  color: #fff;
  transform: rotate(7deg) scale(1.07);
}

.footprint-trail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 85%;
  height: 19px;
  margin: 6px auto 0;
  color: rgba(84, 99, 76, .18);
}

.footprint {
  display: inline-block;
  font-size: .72rem;
  transform: rotate(45deg) scaleX(.72);
  transition: color 280ms var(--ease), transform 280ms var(--spring), filter 280ms var(--ease);
}

.footprint:nth-child(even) { transform: rotate(135deg) scaleX(.72); }
.footprint.active { color: var(--orange); filter: drop-shadow(0 2px 1px rgba(134, 72, 7, .2)); transform: rotate(45deg) scaleX(.78) scale(1.12); }
.footprint:nth-child(even).active { transform: rotate(135deg) scaleX(.78) scale(1.12); }

.progress-row {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.progress-row time:last-child { text-align: right; }

#progress {
  width: 100%;
  height: 24px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

#progress::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--orange) var(--progress, 0%), rgba(36, 90, 68, .13) var(--progress, 0%));
  box-shadow: inset 0 1px 2px rgba(42, 74, 59, .16);
}

#progress::-webkit-slider-thumb {
  width: 21px;
  height: 21px;
  margin-top: -7px;
  appearance: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 3px 9px rgba(131, 75, 12, .26);
}

#progress::-moz-range-track {
  height: 7px;
  border: 0;
  border-radius: 99px;
  background: rgba(36, 90, 68, .13);
}

#progress::-moz-range-progress {
  height: 7px;
  border-radius: 99px;
  background: var(--orange);
}

#progress::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 3px 9px rgba(131, 75, 12, .26);
}

.transport {
  display: grid;
  grid-template-columns: 1fr 94px 1fr;
  align-items: center;
  min-height: 74px;
  margin-top: -2px;
}

.transport .round-button {
  justify-self: center;
  width: 48px;
  height: 48px;
  border-color: #fff;
  background: var(--forest);
}

.play-button {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: center;
  width: 78px;
  height: 78px;
  padding: 0;
  border: 4px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd44d, var(--sun));
  box-shadow: 0 8px 0 #d86d0d, 0 13px 24px rgba(106, 68, 10, .26);
  color: #5b3a06;
  cursor: pointer;
  transition: transform 140ms var(--spring), box-shadow 140ms var(--ease), background-color 220ms var(--ease);
}

.play-button:active {
  box-shadow: 0 3px 0 #d86d0d, 0 7px 14px rgba(106, 68, 10, .2);
  transform: translateY(5px) scale(.94);
}

.play-button svg {
  grid-area: 1 / 1;
  width: 35px;
  height: 35px;
  fill: currentColor;
  transition: opacity 160ms var(--ease), transform 240ms var(--spring);
}

.icon-play { transform: translateX(2px) scale(1); }
.icon-pause,
.icon-replay { opacity: 0; transform: scale(.65) rotate(-12deg); }

.play-button[data-state="pause"] .icon-play,
.play-button[data-state="replay"] .icon-play { opacity: 0; transform: scale(.65) rotate(12deg); }
.play-button[data-state="pause"] .icon-pause { opacity: 1; transform: scale(1) rotate(0); }
.play-button[data-state="replay"] .icon-replay { opacity: 1; transform: scale(1) rotate(0); }

.play-ripple {
  position: absolute;
  inset: -9px;
  border: 3px solid rgba(255, 238, 116, .8);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.is-playing:not(.is-paused):not(.is-frozen) .play-ripple {
  animation: play-ripple 1.04s infinite var(--ease);
}

.beat-indicator {
  display: flex;
  align-items: end;
  justify-self: center;
  gap: 4px;
  width: 48px;
  height: 40px;
  padding: 8px;
  border-radius: 17px;
  background: rgba(11, 107, 83, .1);
}

.beat-indicator span {
  width: 7px;
  height: 10px;
  border-radius: 7px;
  background: var(--forest);
  transform-origin: 50% 100%;
}

.is-playing:not(.is-paused):not(.is-frozen) .beat-indicator span {
  animation: equalize .78s infinite var(--ease);
}

.is-playing:not(.is-paused):not(.is-frozen) .beat-indicator span:nth-child(2) { animation-delay: -.26s; }
.is-playing:not(.is-paused):not(.is-frozen) .beat-indicator span:nth-child(3) { animation-delay: -.52s; }

.player-hint {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.site-credit {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: calc(5px + env(safe-area-inset-bottom));
  left: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.site-credit a {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(4, 58, 46, .48);
  color: rgba(255, 255, 255, .78);
  font-size: .61rem;
  font-weight: 700;
  letter-spacing: .015em;
  line-height: 1.2;
  text-decoration: none;
  text-shadow: 0 1px 5px rgba(0, 34, 27, .45);
  pointer-events: auto;
  backdrop-filter: blur(7px);
  transition: background-color 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--spring);
}

.site-credit a:hover {
  background: rgba(4, 58, 46, .72);
  color: #fff;
  transform: translateY(-1px);
}

.site-credit a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.site-credit span {
  color: #ffc94c;
}

.site-credit strong {
  color: #fff;
  font-weight: 900;
}

.no-script {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: 16px;
  left: 16px;
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  color: #173c34;
  text-align: center;
}

@keyframes title-in {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to { opacity: 1; transform: none; }
}

@keyframes player-in {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to { opacity: 1; transform: none; }
}

@keyframes stage-bop {
  0%, 100% { transform: scale(1.01) translateY(0); }
  46% { transform: scale(1.025) translateY(2px); }
  54% { transform: scale(1.015) translateY(-3px); }
}

@keyframes note-float {
  0% { opacity: 0; transform: translateY(18px) rotate(-8deg) scale(.75); }
  20%, 68% { opacity: .96; }
  100% { opacity: 0; transform: translateY(-24px) rotate(8deg) scale(1.08); }
}

@keyframes play-ripple {
  0% { opacity: .8; transform: scale(.82); }
  78%, 100% { opacity: 0; transform: scale(1.2); }
}

@keyframes equalize {
  0%, 100% { transform: scaleY(.45); }
  50% { transform: scaleY(1.65); }
}

@media (min-width: 620px) {
  body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
  }

  body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(2, 44, 35, .3);
    backdrop-filter: blur(15px);
    content: "";
  }

  .stage {
    width: auto;
    height: min(920px, calc(100svh - 48px));
    min-height: 0;
    max-width: min(520px, calc(100vw - 48px));
    aspect-ratio: 9 / 16;
    border: 5px solid rgba(255, 255, 255, .52);
    border-radius: 38px;
    box-shadow: 0 38px 90px rgba(0, 28, 22, .5);
  }
}

@media (max-height: 760px) {
  .topbar { padding-top: calc(8px + env(safe-area-inset-top)); }
  .utility-button { width: 42px; height: 42px; }
  .hero-copy { margin-top: 5px; }
  .hero-copy h1 { font-size: clamp(1.75rem, 8vw, 2.4rem); }
  .player { bottom: calc(31px + env(safe-area-inset-bottom)); padding-top: 8px; padding-bottom: 9px; }
  .move-prompt { min-height: 60px; }
  .move-icon { width: 44px; height: 44px; }
  .move-prompt { grid-template-columns: 47px 1fr; }
  .transport { min-height: 66px; }
  .play-button { width: 69px; height: 69px; box-shadow: 0 6px 0 #d86d0d, 0 10px 20px rgba(106, 68, 10, .24); }
  .transport { grid-template-columns: 1fr 84px 1fr; }
  .player-hint { display: none; }
}

@media (max-height: 640px) {
  .hero-copy p { display: none; }
  .hero-copy h1 { font-size: 1.6rem; line-height: .9; }
  .footprint-trail { display: none; }
  .move-prompt { min-height: 54px; }
  .progress-row { margin-top: 2px; }
  .transport { min-height: 58px; }
  .play-button { width: 60px; height: 60px; }
  .play-button svg { width: 28px; height: 28px; }
  .transport .round-button, .beat-indicator { transform: scale(.9); }
  .site-credit a { padding-block: 3px; font-size: .56rem; }
}

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

  .air-notes { display: none; }
}
