:root {
  --gold: #c4a66a;
  --gold-rgb: 196, 166, 106;
  --violet: #8c75b7;
  --violet-rgb: 140, 117, 183;
}

:root[data-theme="tidal"] {
  --gold: #70c4c6;
  --gold-rgb: 112, 196, 198;
  --violet: #7599d7;
  --violet-rgb: 117, 153, 215;
}

:root[data-theme="orchid"] {
  --gold: #d78eb6;
  --gold-rgb: 215, 142, 182;
  --violet: #9a8bda;
  --violet-rgb: 154, 139, 218;
}

:root[data-theme="verdant"] {
  --gold: #9cbe77;
  --gold-rgb: 156, 190, 119;
  --violet: #69bcae;
  --violet-rgb: 105, 188, 174;
}

:root { --topbar-expanded-height: 74px; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  backdrop-filter: blur(0);
  transition:
    height 260ms cubic-bezier(.2, .75, .25, 1),
    padding 260ms cubic-bezier(.2, .75, .25, 1),
    background-color 260ms ease,
    box-shadow 260ms ease,
    backdrop-filter 260ms ease;
}

.topbar::before {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: center;
  background: linear-gradient(90deg, transparent, var(--gold), var(--violet), transparent);
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: transform 320ms ease, opacity 220ms ease;
}

.topbar.is-scrolled {
  height: 58px;
  background-color: rgb(9 9 12 / 90%);
  box-shadow: 0 8px 26px rgb(0 0 0 / 28%);
  backdrop-filter: blur(14px);
}

.topbar.is-scrolled::before {
  transform: scaleX(1);
  opacity: .9;
}

.topbar .brand,
.topbar .brand-mark,
.topbar .brand-name {
  transition: gap 260ms ease, width 260ms ease, height 260ms ease, font-size 260ms ease, transform 260ms ease;
}

.topbar.is-scrolled .brand { gap: 9px; }
.topbar.is-scrolled .brand-mark { width: 24px; height: 24px; transform: rotate(-8deg); }
.topbar.is-scrolled .brand-name { font-size: 17px; }

.player-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.player-frame:fullscreen::before { display: none; }

.frame-fullscreen-button {
  position: absolute;
  z-index: 3;
  bottom: 14px;
  left: 14px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgb(var(--gold-rgb) / 55%);
  border-radius: 5px;
  background: rgb(9 9 12 / 82%);
  color: #e7dfd0;
  font-size: 10px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.frame-fullscreen-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.frame-fullscreen-button:hover { transform: translateY(-1px); border-color: var(--gold); background: rgb(21 20 25 / 94%); }
.frame-fullscreen-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 760px) {
  :root { --topbar-expanded-height: 64px; }
}

@property --theme-outline-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes theme-outline-spin {
  to { --theme-outline-angle: 360deg; }
}

.theme-outline-button {
  position: relative;
  isolation: isolate;
}

.theme-outline-button::before {
  position: absolute;
  z-index: 0;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--theme-outline-angle), var(--gold), var(--violet), var(--gold));
  content: "";
  opacity: 0;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  transition: opacity 160ms ease;
}

.theme-outline-button:hover::before,
.theme-outline-button:focus-visible::before {
  opacity: 1;
  animation: theme-outline-spin 2.4s linear infinite;
}

.theme-switch {
  position: fixed;
  z-index: 5;
  right: clamp(18px, 3vw, 42px);
  bottom: 18px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid rgb(var(--gold-rgb) / 38%);
  border-radius: 999px;
  background: rgb(16 16 20 / 88%);
  color: #d7d3dc;
  font: 9px "Avenir Next", Avenir, "Segoe UI", sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.theme-switch:hover {
  transform: translateY(-2px);
  border-color: rgb(var(--gold-rgb) / 78%);
  background: #15151a;
}

.theme-switch:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.theme-swatches {
  display: inline-flex;
  gap: 3px;
}

.theme-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.theme-swatch--primary { background: var(--gold); }
.theme-swatch--secondary { background: var(--violet); }
.theme-switch-icon { color: var(--gold); font-size: 14px; line-height: 1; }

@media (max-width: 760px) {
  .theme-switch { right: 18px; bottom: 16px; }
}

@media (max-width: 430px) {
  .theme-switch { right: 14px; bottom: 13px; min-height: 36px; padding: 0 11px; }
  .topbar { gap: 10px; }
  .topbar .brand { flex: 0 0 auto; }
  .topbar .main-nav { width: auto; min-width: 0; max-width: none; flex: 1 1 0; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .topbar .main-nav::-webkit-scrollbar { display: none; }
  .topbar .nav-link { flex: 0 0 auto; font-size: 8px; letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch,
  .topbar,
  .topbar::before,
  .topbar .brand,
  .topbar .brand-mark,
  .topbar .brand-name { transition: none; }
  .theme-outline-button:hover::before,
  .theme-outline-button:focus-visible::before { animation: none; }
}
