.display-theme-control {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 105;
}

.display-theme-switch {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  min-height: 2.45rem;
  padding: 0.4rem 0.72rem 0.4rem 0.48rem;
  border: 1px solid rgba(244, 238, 221, 0.24);
  border-radius: var(--radius-pill);
  color: rgba(255, 250, 240, 0.88);
  background: rgba(30, 36, 26, 0.72);
  box-shadow: 0 0.8rem 2.5rem rgba(13, 17, 11, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: not-allowed;
  opacity: 0.88;
}

.display-theme-switch__icon {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #2e3528;
  background: #f3ead5;
}

.display-theme-switch__icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.display-theme-switch__copy {
  display: grid;
  min-width: 0;
  text-align: left;
}

.display-theme-switch__copy > span,
.display-theme-switch__copy small {
  color: rgba(255, 250, 240, 0.58);
  font-size: 0.42rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.25;
  text-transform: uppercase;
}

.display-theme-switch__copy strong {
  font-size: 0.62rem;
  line-height: 1.25;
}

.display-theme-switch__copy small {
  margin-top: 0.08rem;
  color: rgba(255, 250, 240, 0.45);
  letter-spacing: 0.06em;
  text-transform: none;
}

.section-navigator {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 120;
  display: grid;
  justify-items: end;
  gap: 0.72rem;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.8rem);
  transition: opacity 180ms ease, transform 220ms ease, visibility 180ms ease;
}

.section-navigator.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.section-navigator__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.58rem;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius-pill);
  color: #fffaf0;
  background: rgba(40, 48, 33, 0.92);
  box-shadow: 0 1rem 2.6rem rgba(8, 12, 7, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.section-navigator__toggle-icon {
  display: grid;
  place-items: center;
}

.section-navigator__toggle-icon svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.section-navigator__toggle-label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-navigator__panel {
  width: min(18rem, calc(100vw - 2rem));
  max-height: min(33rem, calc(100vh - 6rem));
  padding: 0.72rem;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1.35rem;
  color: #fffaf0;
  background: rgba(31, 38, 26, 0.95);
  box-shadow: 0 1.6rem 4rem rgba(7, 10, 6, 0.38);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  overscroll-behavior: contain;
}

.section-navigator__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.62rem 0.72rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.section-navigator__heading > span {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1;
}

.section-navigator__heading small {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.44rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-navigator__item {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 2.7rem;
  padding: 0.42rem 0.62rem;
  border-radius: 0.9rem;
  color: rgba(255, 255, 255, 0.64);
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.section-navigator__item + .section-navigator__item {
  margin-top: 0.15rem;
}

.section-navigator__item--top {
  margin: 0.48rem 0 0.3rem;
  color: #f2d79c;
  background: rgba(255, 255, 255, 0.06);
}

.section-navigator__item.is-active {
  color: #2d3527;
  background: #f3ead5;
}

.section-navigator__number {
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.section-menu-enter-active,
.section-menu-leave-active {
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: right bottom;
}

.section-menu-enter,
.section-menu-leave-to {
  opacity: 0;
  transform: translateY(0.6rem) scale(0.97);
}

@media (max-width: 479px) {
  .display-theme-switch {
    width: 2.6rem;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0;
    justify-content: center;
  }

  .display-theme-switch__copy {
    display: none;
  }

  .section-navigator__toggle {
    width: 3.15rem;
    min-width: 3.15rem;
    height: 3.15rem;
    padding: 0;
  }

  .section-navigator__toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (min-width: 900px) {
  .display-theme-control {
    top: max(1rem, env(safe-area-inset-top));
    right: max(1.25rem, env(safe-area-inset-right));
  }

  .display-theme-switch {
    min-height: 3rem;
    padding: 0.5rem 0.9rem 0.5rem 0.58rem;
  }

  .display-theme-switch__copy strong {
    font-size: 0.72rem;
  }

  .section-navigator {
    right: max(1.5rem, env(safe-area-inset-right));
    bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .section-navigator__panel {
    width: 20rem;
  }

  .section-navigator__item {
    min-height: 3rem;
    font-size: 0.76rem;
  }
}

@media (hover: hover) and (pointer: fine) {
  .section-navigator__toggle:hover {
    transform: translateY(-2px);
    background: rgba(51, 61, 42, 0.98);
  }

  .section-navigator__item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
  }

  .section-navigator__item.is-active:hover {
    color: #2d3527;
    background: #fff4dc;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section-navigator,
  .section-menu-enter-active,
  .section-menu-leave-active {
    transition: none;
  }
}
