*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: #ffffff;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#canvas-wrap {
  width: 100%;
  height: 100%;
}

#canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

#canvas-wrap canvas.pan-ready:active {
  cursor: grabbing;
}

.bottom-ui {
  position: absolute;
  bottom: max(18%, calc(env(safe-area-inset-bottom, 0px) + 3.5rem));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: min(100%, 26rem);
  padding: 0 1rem 1.35rem;
  pointer-events: none;
}

.bottom-ui-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 0.65rem;
  row-gap: 0.35rem;
  padding: 2.35rem 1.1rem 1.85rem;
  border-radius: 1.25rem;
  background: rgba(255, 228, 236, 0.28);
  border: 1px solid rgba(200, 130, 160, 0.32);
  outline: 1px solid rgba(255, 245, 248, 0.6);
  outline-offset: -2px;
  box-shadow: 0 2px 16px rgba(140, 118, 130, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}

.bottom-ui-inner > .nav-wrap:first-child {
  justify-self: end;
}

.bottom-ui-inner > .nav-wrap:last-child {
  justify-self: start;
}

.hint-center {
  position: relative;
  grid-column: 2;
  justify-self: center;
}

.hint {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: rgba(150, 128, 140, 0.72);
  pointer-events: none;
  transition: opacity 0.6s ease;
  white-space: nowrap;
  text-align: center;
}

.hint.hidden {
  opacity: 0;
}

.music-btn {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.4rem);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(150, 128, 140, 0.72);
  cursor: pointer;
  transition: opacity 0.4s ease, color 0.2s ease, transform 0.2s ease;
}

.music-btn.hidden {
  display: none;
}

.music-btn:hover {
  color: rgba(184, 122, 150, 0.85);
  transform: translateX(-50%) scale(1.08);
}

.music-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.music-icon--off {
  display: none;
}

.music-btn[aria-pressed="false"] .music-icon--on {
  display: none;
}

.music-btn[aria-pressed="false"] .music-icon--off {
  display: block;
}

.nav-wrap {
  position: relative;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  transition: opacity 0.4s ease, width 0.4s ease;
}

.nav-wrap.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nav-hint {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: rgba(150, 128, 140, 0.62);
  white-space: nowrap;
  pointer-events: none;
}

.nav-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  color: rgba(150, 128, 140, 0.72);
  cursor: pointer;
  transition: opacity 0.4s ease, color 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.nav-btn::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.nav-btn--prev::before {
  transform: rotate(45deg);
  margin-left: 0.2rem;
}

.nav-btn--next::before {
  transform: rotate(-135deg);
  margin-right: 0.2rem;
}

.nav-btn:hover {
  color: rgba(184, 122, 150, 0.85);
  transform: scale(1.08);
}

@media (max-width: 640px) {
  .bottom-ui {
    bottom: max(24%, calc(env(safe-area-inset-bottom, 0px) + 8rem));
    width: min(100%, 22rem);
    padding: 0 0.5rem 0.75rem;
  }

  .bottom-ui-inner {
    column-gap: 0.45rem;
    padding: 2rem 0.75rem 1.55rem;
    border-radius: 1.1rem;
  }

  .hint {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }

  .nav-hint {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
  }

  .nav-wrap {
    width: 2.75rem;
    height: 2.75rem;
  }

  .nav-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  .nav-btn::before {
    width: 0.5rem;
    height: 0.5rem;
  }

  .music-btn {
    width: 2.25rem;
    height: 2.25rem;
  }

  .music-icon {
    width: 1.45rem;
    height: 1.45rem;
  }
}
