:root {
  --ui-size: clamp(56px, 6vw, 78px);
  --ui-gap: clamp(10px, 2vw, 16px);
}

* {
  box-sizing: border-box;
}

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0b1017;
  touch-action: none;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
}

#ambient-fill {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center;
  filter: blur(20px) saturate(0.95) brightness(0.36);
  transform: scale(1.07);
  transition: background-image 300ms ease;
}

#ambient-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(17, 24, 33, 0.1) 0%, rgba(8, 12, 16, 0.5) 100%);
}

#stage-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(1920px, 100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  z-index: 2;
}

#background-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#background-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.btn-instrument {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(58px, 4.9vw, 81px);
  height: clamp(58px, 4.9vw, 81px);
  border: 2px solid rgba(241, 237, 226, 0.56);
  border-radius: 999px;
  background: rgba(6, 11, 17, 0.4);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.34);
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  isolation: isolate;
}

.btn-instrument::after {
  content: "";
  position: absolute;
  width: 86%;
  height: 86%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(4, 8, 13, 0.54) 0%, rgba(5, 10, 16, 0.35) 66%, rgba(5, 10, 16, 0) 100%);
  pointer-events: none;
  z-index: 0;
}

.btn-instrument::before {
  content: "";
  position: absolute;
  width: 78%;
  height: 78%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(242, 247, 255, 0.82) 0%, rgba(214, 228, 244, 0.2) 70%, rgba(214, 228, 244, 0) 100%);
  opacity: 0.4;
  transform: scale(1);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 1;
}

.note-icon {
  width: 58%;
  height: 58%;
  object-fit: contain;
  opacity: 1;
  position: relative;
  z-index: 2;
  pointer-events: none;
  filter: brightness(0) invert(1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
  transition: transform 180ms ease, filter 180ms ease, opacity 180ms ease;
}

.btn-instrument:active .note-icon {
  transform: scale(0.94);
}

.btn-instrument.is-active::before {
  opacity: 0.86;
  transform: scale(1.12);
}

.btn-instrument.is-active::after {
  background: radial-gradient(circle, rgba(50, 33, 7, 0.56) 0%, rgba(38, 25, 6, 0.38) 66%, rgba(38, 25, 6, 0) 100%);
}

.btn-instrument.is-active .note-icon {
  opacity: 1;
  transform: scale(1.14);
  filter: brightness(0) invert(1) drop-shadow(0 0 14px rgba(255, 255, 255, 0.75)) drop-shadow(0 0 28px rgba(255, 220, 120, 0.95));
}

.btn-instrument.is-active {
  border-color: rgba(255, 220, 112, 0.95);
  background: rgba(84, 54, 12, 0.37);
  box-shadow: 0 0 24px rgba(255, 210, 120, 0.48);
}

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, rgba(165, 140, 96, 0.44), rgba(11, 16, 24, 0.88));
  backdrop-filter: blur(4px);
  z-index: 30;
  transition: opacity 320ms ease;
  overflow: hidden;
}

#overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--overlay-image);
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  filter: saturate(1.05);
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.start-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 30px 34px;
  border-radius: 24px;
  border: none;
  background: rgba(10, 16, 24, 0.36);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.36);
  text-align: center;
  z-index: 1;
}

.start-title {
  margin: 0;
  font: 600 clamp(24px, 3.1vw, 40px)/1.1 "Avenir Next", "Segoe UI", sans-serif;
  color: #f8f3e9;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.38);
}

.start-subtitle {
  margin: 0;
  font: 500 clamp(14px, 1.6vw, 19px)/1.2 "Avenir Next", "Segoe UI", sans-serif;
  color: rgba(245, 239, 227, 0.9);
}

#play-btn {
  width: clamp(92px, 10.5vw, 136px);
  height: clamp(92px, 10.5vw, 136px);
  border-radius: 999px;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 140ms ease;
}

#play-btn:active {
  transform: scale(0.96);
}

.play-icon {
  width: 0;
  height: 0;
  border-left: clamp(34px, 3.6vw, 48px) solid rgba(251, 246, 234, 0.95);
  border-top: clamp(22px, 2.3vw, 30px) solid transparent;
  border-bottom: clamp(22px, 2.3vw, 30px) solid transparent;
  margin-left: clamp(6px, 0.8vw, 10px);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.42));
}

.ui {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.icon-button {
  pointer-events: auto;
  width: var(--ui-size);
  height: var(--ui-size);
  border: 0;
  border-radius: 999px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.44);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  text-decoration: none;
}

.icon-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.45));
}

#exit-btn {
  position: absolute;
  top: 24px;
  right: 24px;
}

.volume-control {
  position: absolute;
  left: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: var(--ui-gap);
  pointer-events: auto;
}

#volume-slider {
  width: clamp(140px, 16vw, 230px);
  accent-color: #e6d7b3;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.volume-control.open #volume-slider {
  opacity: 1;
  pointer-events: auto;
}

#volume-toggle.is-muted {
  opacity: 0.62;
}

#volume-toggle.is-muted::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: 50%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 93, 93, 0.95);
  transform: rotate(-28deg);
}

@media (max-width: 900px) {
  #exit-btn {
    top: 14px;
    right: 14px;
  }

  .volume-control {
    left: 14px;
    bottom: 14px;
  }
}
