:root {
  --site-sidebar-width: 60px;
  --site-sidebar-bg: #1a1a1a;
  --site-sidebar-line: rgba(255, 255, 255, .1);
  --site-sidebar-text: #f3f3f3;
  --site-sidebar-muted: #a1a1a1;
  --site-sidebar-accent: #e64b22;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 160ms;
  animation-timing-function: cubic-bezier(.2, .8, .2, 1);
  mix-blend-mode: normal;
}

.site-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--site-sidebar-width);
  min-width: var(--site-sidebar-width);
  height: 100vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-right: 1px solid var(--site-sidebar-line);
  background: var(--site-sidebar-bg);
  color: var(--site-sidebar-text);
  overflow: visible;
  view-transition-name: renoise-sidebar;
}

::view-transition-old(renoise-sidebar),
::view-transition-new(renoise-sidebar) {
  animation: none;
}

.site-sidebar svg {
  display: block;
  flex: 0 0 auto;
}

.site-sidebar__main {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.site-home {
  width: 60px;
  height: 32px;
  padding: 4px 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
}

.site-home:hover { transform: scale(.98); }
.site-home svg { width: 24px; height: 24px; }
.site-home.is-active { color: #fff; }

.site-home__divider {
  width: 60px;
  height: 25px;
  padding: 12px 18px;
}

.site-home__divider::after,
.site-nav__divider::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background: var(--site-sidebar-line);
}

.site-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.site-nav__item {
  width: 60px;
  height: 62px;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 9px;
  color: var(--site-sidebar-text);
  text-decoration: none;
  transition: color .15s ease, background .15s ease, transform .15s ease;
}

.site-nav__item svg { width: 32px; height: 32px; }

.site-nav__item span {
  font: 500 10px/12px Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  white-space: nowrap;
}

.site-nav__item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .065);
}

.site-nav__item:active { transform: scale(.96); }
.site-nav__item.is-active { color: var(--site-sidebar-accent); }

.site-nav__divider {
  width: 60px;
  height: 25px;
  padding: 12px;
}

.site-sidebar__bottom {
  width: 100%;
  margin-top: auto;
  padding: 10px 3px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.site-account {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--site-sidebar-muted);
  background: transparent;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.site-theme {
  width: 26px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--site-sidebar-muted);
  background: transparent;
  cursor: pointer;
}

.site-account[aria-expanded="true"] {
  color: var(--site-sidebar-accent);
  background: rgba(230, 75, 34, .12);
  border-color: rgba(230, 75, 34, .22);
}

.site-theme:hover,
.site-account:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.site-theme:active,
.site-account:active { transform: scale(.96); }

.site-theme svg { width: 16px; height: 16px; }

.site-account { font: inherit; }

.site-account__avatar,
.site-account-menu__avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  color: #ddd;
  background: #2c2c2c;
  font: 500 11px/1 Inter, "PingFang SC", system-ui, sans-serif;
}

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

.site-account__mobile-label { display: none; }

.site-popover[hidden],
.site-account-menu__admin[hidden],
.site-account-menu__status[hidden] { display: none !important; }

.site-popover {
  position: fixed;
  z-index: 90;
  left: 68px;
  width: 224px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 16px;
  color: var(--site-sidebar-text);
  background: #202020;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .42);
  animation: site-popover-in .2s cubic-bezier(.2, .8, .2, 1);
}

.site-account-menu a,
.site-account-menu__logout {
  position: relative;
  min-height: 42px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: var(--site-sidebar-muted);
  background: transparent;
  font: 500 13px/1.4 "Roboto Flex", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: color .18s ease, background .18s ease;
}

.site-account-menu a:hover,
.site-account-menu__logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.site-account-menu a.is-active {
  color: var(--site-sidebar-accent);
  background: rgba(230, 75, 34, .12);
}

.site-account-menu svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.site-account-menu {
  bottom: 56px;
  width: 236px;
  max-height: min(520px, calc(100vh - 72px));
  overflow-y: auto;
}

.site-account-menu__identity {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  margin-bottom: 6px;
}

.site-account-menu__identity > span:last-child {
  min-width: 0;
  display: block;
}

.site-account-menu__identity strong {
  overflow: hidden;
  color: #f3f3f3;
  font: 600 14px/1.25 "Roboto Flex", "Noto Sans SC", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-account-menu__admin {
  display: grid;
  gap: 2px;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.site-account-menu__logout { color: #c9c9c9; }
.site-account-menu__logout:hover { color: #ff7654; background: rgba(255, 118, 84, .1); }
.site-account-menu__logout:disabled { cursor: wait; opacity: .6; }

.site-account-menu__status {
  margin: 5px 10px 2px;
  color: #ff7654;
  font: 400 11px/1.4 "Roboto Flex", "Noto Sans SC", sans-serif;
}

@keyframes site-popover-in {
  from { opacity: 0; transform: translateX(-4px) scale(.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.site-version {
  box-sizing: border-box;
  z-index: 2147483000;
  display: block;
  color: rgba(255,255,255,.52);
  font-family: "Roboto Flex", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 12px;
  letter-spacing: 0;
  font-variation-settings: "GRAD" 60, "XOPQ" 96, "XTRA" 468, "YOPQ" 79, "YTAS" 750, "YTDE" -203, "YTFI" 738, "YTLC" 514, "YTUC" 712, "wdth" 100;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.site-sidebar a:focus-visible,
.site-sidebar button:focus-visible {
  outline: 2px solid var(--site-sidebar-accent);
  outline-offset: 1px;
}

html.light {
  --site-sidebar-bg: #f1f1ef;
  --site-sidebar-line: rgba(0, 0, 0, .1);
  --site-sidebar-text: #222;
  --site-sidebar-muted: #707070;
}

html.light .site-account__avatar {
  border-color: rgba(0, 0, 0, .14);
  color: #222;
  background: #e2e2df;
}

html.light .site-account-menu__avatar {
  border-color: rgba(0, 0, 0, .14);
  color: #222;
  background: #e2e2df;
}

html.light .site-popover {
  border-color: rgba(0, 0, 0, .12);
  color: #222;
  background: #f1f1ef;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .18);
}

html.light .site-account-menu__identity { border-color: rgba(0, 0, 0, .1); }
html.light .site-account-menu__identity strong { color: #222; }
html.light .site-account-menu a:hover,
html.light .site-account-menu__logout:hover { background: rgba(0, 0, 0, .06); }

html.light .site-version { color: rgba(0,0,0,.5); }

@media (max-height: 700px) and (min-width: 761px) {
  .site-sidebar__main { padding-block: 8px; }
  .site-home__divider,
  .site-nav__divider { height: 17px; padding-block: 8px; }
  .site-nav__item { height: 54px; padding-block: 5px; }
  .site-nav__item svg { width: 28px; height: 28px; }
  .site-sidebar__bottom { padding-block: 5px; gap: 2px; }
}

@media (max-width: 760px) {
  .home-app,
  .audio-shell,
  .library-shell { padding-bottom: 58px; }

  .site-sidebar {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    height: 58px;
    min-width: 0;
    padding: 3px max(8px, env(safe-area-inset-right)) max(3px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    flex-direction: row;
    align-items: center;
    border-top: 1px solid var(--site-sidebar-line);
    border-right: 0;
  }

  .site-sidebar__main {
    display: contents;
  }

  .site-home,
  .site-nav__divider,
  .site-home__divider { display: none; }

  .site-nav {
    width: auto;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
  }

  .site-nav__item { width: auto; height: 48px; padding: 4px 0; }
  .site-nav__item svg { width: 24px; height: 24px; }

  .site-sidebar__bottom {
    width: 48px;
    flex: 0 0 48px;
    margin: 0;
    padding: 0;
    display: block;
  }

  .site-theme,
  .site-version { display: none !important; }

  .site-account {
    width: 48px;
    height: 48px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-radius: 9px;
  }

  .site-account__avatar { width: 24px; height: 24px; }
  .site-account__mobile-label {
    display: block;
    font: 500 10px/12px Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  }

  .site-popover.site-account-menu {
    position: fixed;
    inset: auto 10px calc(66px + env(safe-area-inset-bottom)) 10px;
    width: auto;
    max-height: min(620px, calc(100vh - 88px));
    overflow-y: auto;
    border-radius: 18px;
    animation-name: site-sheet-in;
  }

  html.light .site-account-menu__admin { border-color: rgba(0, 0, 0, .1); }

  @keyframes site-sheet-in {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

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

  .site-popover { animation-duration: 1ms; }
}
