:root {
  color-scheme: dark;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  overscroll-behavior-x: none;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: experience-page-out .42s cubic-bezier(.7, 0, .84, 0) both;
}

::view-transition-new(root) {
  animation: experience-page-in .64s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes experience-page-out {
  to {
    opacity: 0;
    filter: blur(8px);
    transform: scale(1.025);
  }
}

@keyframes experience-page-in {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: scale(.985);
  }
}

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

.experience-controls {
  position: fixed;
  top: clamp(14px, 2.4vw, 24px);
  right: clamp(16px, 3.2vw, 48px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
}

.experience-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  background: rgba(6, 7, 9, .64);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .26);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  backdrop-filter: blur(18px) saturate(125%);
}

.experience-tabs a {
  min-width: 62px;
  padding: 8px 13px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .56);
  font: 600 11px/1 "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: .08em;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color .25s ease, background .25s ease, transform .25s ease;
}

.experience-tabs a:hover {
  color: rgba(255, 255, 255, .92);
  transform: translateY(-1px);
}

.experience-tabs a[aria-current="page"] {
  color: #0a0b0d;
  background: #f2efe8;
}

.sound-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 50%;
  color: #f2efe8;
  background: rgba(6, 7, 9, .64);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .26);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  backdrop-filter: blur(18px) saturate(125%);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .25s ease, background .25s ease, transform .25s ease;
}

.sound-toggle:hover {
  border-color: rgba(255, 255, 255, .32);
  background: rgba(15, 17, 20, .82);
  transform: translateY(-1px);
}

.sound-toggle:focus-visible,
.experience-tabs a:focus-visible {
  outline: 2px solid #f2efe8;
  outline-offset: 3px;
}

.sound-icon,
.sound-icon::before,
.sound-icon::after,
.sound-icon i {
  position: absolute;
  display: block;
}

.sound-icon {
  inset: 0;
}

.sound-icon::before {
  content: "";
  left: 11px;
  top: 15px;
  width: 6px;
  height: 10px;
  border-radius: 2px 0 0 2px;
  background: currentColor;
  box-shadow: 4px 0 0 -1px currentColor;
  clip-path: polygon(0 20%, 42% 20%, 100% 0, 100% 100%, 42% 80%, 0 80%);
}

.sound-icon::after {
  content: "";
  right: 10px;
  top: 13px;
  width: 10px;
  height: 14px;
  border-right: 1.5px solid currentColor;
  border-radius: 0 50% 50% 0;
  opacity: 0;
  transform: scaleX(.7);
  transform-origin: left center;
  transition: opacity .22s ease, transform .22s ease;
}

.sound-icon i {
  left: 19px;
  top: 11px;
  width: 1.5px;
  height: 18px;
  border-radius: 2px;
  background: #d65d50;
  transform: rotate(-43deg);
  transition: opacity .22s ease;
}

.sound-toggle[aria-pressed="true"] .sound-icon::after {
  opacity: 1;
  transform: scaleX(1);
}

.sound-toggle[aria-pressed="true"] .sound-icon i {
  opacity: 0;
}

.music-credit {
  position: fixed;
  left: clamp(18px, 3vw, 46px);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 100;
  color: rgba(242, 239, 232, .58);
  font: 500 10px/1.4 "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: .04em;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: color .25s ease, opacity .35s ease, transform .35s ease;
}

body.music-on .music-credit {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.music-credit:hover {
  color: rgba(242, 239, 232, .92);
}

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

@media (max-width: 640px) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }

  .experience-controls {
    top: 12px;
    top: calc(12px + env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    width: auto;
    gap: 7px;
  }

  .experience-tabs {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .experience-tabs a {
    display: grid;
    place-items: center;
    flex: 1;
    min-width: 0;
    min-height: 42px;
    padding: 8px;
    font-size: 9.5px;
    white-space: nowrap;
  }

  .sound-toggle {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .sound-icon::before {
    left: 12px;
    top: 16px;
  }

  .sound-icon::after {
    right: 10px;
    top: 14px;
  }

  .sound-icon i {
    left: 20px;
    top: 12px;
  }

  .music-credit {
    left: 14px;
    bottom: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: 58vw;
    font-size: 9px;
  }
}

@media (max-width: 430px) {
  .experience-tabs a {
    min-width: 43px;
    padding-inline: 6px;
    font-size: 9px;
    letter-spacing: .06em;
  }
}

@media (max-width: 360px) {
  .experience-controls {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    gap: 5px;
  }

  .experience-tabs {
    gap: 1px;
    padding: 3px;
  }

  .experience-tabs a {
    min-width: 41px;
    padding-inline: 4px;
    font-size: 8.5px;
    letter-spacing: .04em;
  }

  .sound-toggle {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .sound-icon::before {
    left: 11px;
    top: 15px;
  }

  .sound-icon::after {
    right: 10px;
    top: 13px;
  }

  .sound-icon i {
    left: 19px;
    top: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }

  .experience-tabs a,
  .sound-toggle,
  .music-credit,
  .sound-icon::after,
  .sound-icon i {
    transition: none;
  }
}
