:root {
  --ink: #182421;
  --muted: #65746f;
  --paper: rgba(251, 250, 244, 0.86);
  --line: rgba(24, 36, 33, 0.15);
  --moss: #3f6f5b;
  --coral: #c86f66;
  --gold: #d4a448;
  --aqua: #6aa9a8;
  --plum: #7b6ba8;
  --cream: #f8f3df;
  --shadow: 0 24px 70px rgba(24, 36, 33, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #dce8df;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

canvas {
  display: block;
}

.musecal-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #dce8df;
}

.intro {
  position: absolute;
  inset: 20px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(248, 243, 223, 0.94), rgba(220, 232, 223, 0.84)),
    radial-gradient(circle at 22% 20%, rgba(106, 169, 168, 0.24), transparent 36%);
  box-shadow: var(--shadow);
  transition:
    opacity 420ms ease,
    transform 420ms ease,
    visibility 420ms ease;
}

.intro.is-hidden {
  visibility: hidden;
  opacity: 0;
  transform: scale(1.025);
  pointer-events: none;
}

.intro-media {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(63, 111, 91, 0.18), rgba(200, 111, 102, 0.1)),
    repeating-linear-gradient(
      100deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0.16) 1px,
      transparent 1px,
      transparent 32px
    );
}

.sun {
  position: absolute;
  left: 16%;
  top: 14%;
  width: min(34vw, 360px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 246, 202, 0.96), rgba(212, 164, 72, 0.58) 45%, transparent 68%);
  animation: pulse 4s ease-in-out infinite;
}

.orbital {
  position: absolute;
  border: 2px solid rgba(24, 36, 33, 0.14);
  border-radius: 50%;
  transform: rotate(-8deg);
}

.orbital.one {
  left: 10%;
  top: 18%;
  width: 60%;
  height: 46%;
}

.orbital.two {
  left: 20%;
  top: 30%;
  width: 64%;
  height: 48%;
  border-color: rgba(200, 111, 102, 0.2);
}

.orbital.three {
  left: 7%;
  top: 48%;
  width: 56%;
  height: 30%;
  border-color: rgba(106, 169, 168, 0.25);
}

.avatar-large {
  position: absolute;
  left: 38%;
  bottom: 10%;
  width: min(28vw, 240px);
  aspect-ratio: 0.68;
  border-radius: 48% 48% 18% 18%;
  background: linear-gradient(180deg, #f0bf9e 0 28%, #3f6f5b 28% 72%, #263a35 72%);
  box-shadow: 0 36px 70px rgba(24, 36, 33, 0.22);
}

.avatar-large span {
  position: absolute;
  left: 20%;
  top: 12%;
  width: 60%;
  height: 10%;
  border-radius: 999px;
  background: rgba(24, 36, 33, 0.72);
}

.intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 6vw, 74px);
}

.intro-actions,
.control-row,
.instrument-grid,
.sliders,
.prompt-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--moss);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(4.8rem, 11vw, 9rem);
  line-height: 0.86;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

p {
  color: var(--muted);
  line-height: 1.58;
  overflow-wrap: break-word;
}

.primary,
.secondary,
.icon-button,
.instrument,
.movement-pad button,
.prompt-chip {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 900;
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.primary,
.secondary {
  padding: 0 18px;
}

.primary {
  width: fit-content;
  background: var(--moss);
  color: white;
  box-shadow: 0 14px 32px rgba(63, 111, 91, 0.24);
}

.secondary,
.icon-button,
.instrument,
.prompt-chip {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: 1px solid var(--line);
}

button:hover {
  transform: translateY(-1px);
}

.topbar,
.mic-lab,
.guide,
.lyric-panel,
.control-panel,
.movement-pad,
.modal {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 54px rgba(24, 36, 33, 0.14);
  backdrop-filter: blur(18px);
}

.topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 5;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(140px, 24vw);
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.home-link {
  display: grid;
  min-height: 46px;
  place-items: center;
  border-radius: 8px;
  background: rgba(63, 111, 91, 0.1);
  color: var(--moss);
  font-weight: 950;
  text-decoration: none;
}

.topbar h2,
.lyric-panel h2 {
  margin-bottom: 0;
}

.meter {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 36, 33, 0.08);
}

.meter span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--aqua), var(--gold), var(--coral));
  transition: width 80ms linear;
}

.mic-lab {
  position: absolute;
  top: 102px;
  left: 392px;
  z-index: 4;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
  padding: 14px;
}

.mic-lab h2 {
  margin-bottom: 0;
}

.mic-readouts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border-radius: 8px;
  outline: 1px solid var(--line);
}

.mic-readouts div {
  min-width: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.36);
}

.mic-readouts span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mic-readouts strong {
  display: block;
  margin-top: 3px;
  font-size: clamp(0.85rem, 1.7vw, 1.1rem);
  overflow-wrap: break-word;
}

.breath-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 36, 33, 0.08);
}

.breath-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--moss), var(--aqua), var(--gold));
  transition: width 120ms linear;
}

#mic-coach {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.guide {
  position: absolute;
  top: 102px;
  left: 16px;
  z-index: 4;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  grid-template-columns: 70px 1fr;
  gap: 12px;
  padding: 12px;
}

.guide-face {
  position: relative;
  height: 70px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 36%, #efbf9d 0 28%, transparent 29%),
    linear-gradient(180deg, #263a35 0 30%, #7b6ba8 30%);
}

.guide-face span {
  position: absolute;
  left: 24%;
  top: 24%;
  width: 52%;
  height: 7px;
  border-radius: 999px;
  background: #263a35;
}

.guide strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.35rem;
}

.guide p:last-child {
  margin-bottom: 0;
  font-size: 0.94rem;
}

.lyric-panel {
  position: absolute;
  right: 16px;
  top: 102px;
  z-index: 4;
  width: min(500px, calc(100vw - 32px));
  padding: 16px;
}

.control-panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  display: grid;
  width: min(620px, calc(100vw - 32px));
  gap: 12px;
  padding: 14px;
}

.icon-button {
  min-width: 78px;
  padding: 0 12px;
}

.icon-button.is-on,
.instrument.is-active {
  background: var(--ink);
  color: white;
}

.instrument-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.instrument {
  display: grid;
  min-height: 72px;
  place-items: center;
  gap: 4px;
  padding: 8px;
  text-align: center;
}

.instrument span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.sliders label,
.reflection-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--moss);
}

.movement-pad {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 4;
  display: none;
  gap: 8px;
  padding: 10px;
}

.movement-pad button {
  width: 48px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.modal {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 20px;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(24, 36, 33, 0.42);
  backdrop-filter: blur(4px);
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 900;
}

.prompt-list {
  margin: 12px 0 16px;
}

.prompt-chip {
  padding: 0 12px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  text-transform: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.98);
    opacity: 0.78;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .intro {
    inset: 10px;
    grid-template-columns: 1fr;
  }

  .intro-media {
    min-height: 42vh;
  }

  .intro-copy {
    padding: 24px;
  }

  h1 {
    font-size: clamp(4rem, 18vw, 5.2rem);
  }

  .topbar {
    grid-template-columns: 64px 1fr;
  }

  .meter {
    grid-column: 1 / -1;
  }

  .guide {
    display: none;
  }

  .mic-lab {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 206px;
    width: auto;
  }

  .lyric-panel {
    top: 120px;
    left: 16px;
    right: 16px;
    width: auto;
  }

  .control-panel {
    left: 16px;
    width: auto;
  }

  .movement-pad {
    display: grid;
  }
}

@media (max-width: 560px) {
  .topbar,
  .lyric-panel,
  .control-panel {
    left: 10px;
    right: 10px;
  }

  .topbar {
    top: 10px;
  }

  .lyric-panel {
    top: 116px;
    padding: 13px;
  }

  .control-panel {
    bottom: 10px;
    padding: 11px;
  }

  .mic-lab {
    display: none;
  }

  .instrument-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sliders {
    grid-template-columns: 1fr;
  }

  .movement-pad {
    display: none;
  }
}
