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

:root {
  --mantle: #181825;
  --crust: #11111b;
  --s0: #313244;
  --s1: #45475a;
  --ov0: #6c7086;
  --text: #cdd6f4;
  --sub0: #a6adc8;
  --lav: #b4befe;
  --blue: #89b4fa;
  --peach: #fab387;
  --mauve: #cba6f7;
}

body {
  background: var(--crust);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
}

.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--mantle);
  border-bottom: 1px solid var(--s0);
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 8px;
  gap: 5px;
}

.hdr select {
  background: var(--s0);
  color: var(--text);
  border: 1px solid var(--s1);
  padding: 5px 20px 5px 8px;
  font-size: 0.74rem;
  font-family: inherit;
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath d='M2 3l2 2 2-2' stroke='%23a6adc8' stroke-width='1' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

#slv {
  width: auto;
  max-width: 140px;
  flex-shrink: 0;
}

#sls {
  width: auto;
  min-width: 85px;
  max-width: 120px;
  flex-shrink: 0;
}

.nav {
  background: none;
  border: none;
  color: var(--sub0);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
}

.nav:hover {
  color: var(--text);
}

.nav:disabled {
  opacity: 0.15;
  cursor: default;
}

.spacer {
  flex: 1;
}

.tbtn {
  background: none;
  border: 1px solid var(--s1);
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.2s;
  color: var(--sub0);
}

.tbtn:hover {
  border-color: var(--sub0);
}

.tbtn.on {
  border-color: var(--peach);
  background: rgba(250, 179, 135, 0.08);
  color: var(--peach);
}

.tbtn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 4px 4px 56px;
}

.pg {
  background: var(--mantle);
  margin-bottom: 1px;
}

.pi {
  position: relative;
  line-height: 0;
}

.pi img {
  width: 100%;
  display: block;
  transition: filter 0.3s;
}

.pi img.inv {
  filter: invert(1) hue-rotate(180deg);
}

.hs {
  position: absolute;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 2;
  border-radius: 2px;
}

.hs:hover {
  background: rgba(203, 166, 247, 0.2);
}

.hs.on {
  background: rgba(250, 179, 135, 0.2);
  box-shadow: 0 0 0 2px var(--peach);
  animation: glow 0.8s ease infinite alternate;
}

@keyframes glow {
  from { box-shadow: 0 0 0 2px var(--peach); }
  to { box-shadow: 0 0 6px 2px var(--peach); }
}

.shield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: multiply;
  transition: background 0.4s;
  background: transparent;
}

.shield.warm {
  background: rgba(80, 50, 0, 0.20);
}

.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--mantle);
  border-top: 1px solid var(--s0);
  padding: 0 12px;
  display: none;
  align-items: center;
  gap: 12px;
  height: 48px;
}

.player.v {
  display: flex;
}

.pp {
  width: 36px;
  height: 36px;
  background: var(--s0);
  color: var(--mauve);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  transition: background 0.15s;
}

.pp:hover {
  background: var(--s1);
}

.pp svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.bar {
  flex: 1;
  height: 20px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
}

.bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--s0);
  border-radius: 2px;
}

.progress {
  position: absolute;
  left: 0;
  height: 4px;
  background: var(--mauve);
  width: 0%;
  border-radius: 2px;
  pointer-events: none;
  transition: none;
}

.thumb {
  position: absolute;
  left: 0%;
  width: 14px;
  height: 14px;
  background: var(--mauve);
  border-radius: 3px;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  transition: none;
}

.time {
  font-size: 0.7rem;
  color: var(--sub0);
  font-variant-numeric: tabular-nums;
  min-width: 62px;
  text-align: right;
  flex-shrink: 0;
}

.close {
  background: none;
  border: none;
  color: var(--sub0);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 5px;
  border-radius: 3px;
}

.close:hover {
  color: var(--text);
}

.bottom-nav {
  display: flex;
  justify-content: space-between;
  padding: 12px 4px;
  margin-top: 2px;
}

.bottom-nav span {
  font-size: 0.76rem;
  color: var(--blue);
  cursor: pointer;
}

.bottom-nav span:hover {
  text-decoration: underline;
}

.credit {
  text-align: center;
  padding: 10px 4px 18px;
  font-size: 0.75rem;
  color: var(--ov0);
}

.credit a {
  color: var(--ov0);
  text-decoration: none;
}

.credit a:hover {
  color: var(--sub0);
  text-decoration: underline;
}

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ov0);
  font-size: 0.85rem;
}

@media (max-width: 500px) {
  .hdr {
    padding: 0 5px;
    gap: 3px;
  }

  #slv {
    max-width: 110px;
    font-size: 0.7rem;
    padding: 4px 16px 4px 6px;
  }

  #sls {
    min-width: 72px;
    max-width: 100px;
    font-size: 0.7rem;
    padding: 4px 16px 4px 6px;
  }

  .nav {
    font-size: 0.78rem;
  }

  .main {
    padding: 2px 0 54px;
  }

  .player {
    padding: 0 8px;
    gap: 8px;
  }
}
