:root {
  --bg: #040812;
  --bg-soft: #071225;
  --panel: #0c1322;
  --panel-2: #101a2c;
  --panel-3: #13203a;
  --border: #1f335a;
  --text: #f3f8ff;
  --muted: #9bb1d1;
  --muted-2: #6f84a9;
  --accent: #27d3ff;
  --accent-2: #7be8ff;
  --accent-deep: #1b93d3;
  --danger: #ff647a;
  --ok: #5df2d0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

@font-face {
  font-family: SpotifyMixUI;
  src: url('https://encore.scdn.co/fonts/SpotifyMixUI-Regular-cc3b1de388efa4cbca6c75cebc24585e.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: SpotifyMixUI;
  src: url('https://encore.scdn.co/fonts/SpotifyMixUI-Bold-4264b799009b1db5c491778b1bc8e5b7.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: SpotifyMixUITitle;
  src: url('https://encore.scdn.co/fonts/SpotifyMixUITitleVariable-8769ccfde3379b7ebcadd9529b49d0cc.woff2') format('woff2');
  font-style: normal;
  font-display: swap;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at -8% -10%, rgba(39, 211, 255, 0.2), transparent 55%),
    radial-gradient(1000px 640px at 110% -15%, rgba(123, 232, 255, 0.16), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: SpotifyMixUI, Inter, system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.app {
  min-height: 100vh;
  padding: 8px;
  padding-bottom: 110px;
}

.panel {
  background: linear-gradient(160deg, rgba(14, 23, 40, 0.92), rgba(9, 15, 29, 0.96));
  border-radius: var(--radius);
  border: 1px solid rgba(123, 179, 255, 0.17);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.spotify-shell {
  display: grid;
  grid-template-columns: 320px minmax(620px, 1fr) 360px;
  gap: 8px;
  height: calc(100vh - 124px);
}

.left-col,
.center-col,
.right-col {
  min-height: 100%;
  overflow: hidden;
}

.left-col {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.center-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.right-col {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 10px;
}

.brand-logo,
.brand-logo-fallback {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), #1f7adf);
}

.brand-logo-fallback {
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand-title {
  font-family: SpotifyMixUITitle, SpotifyMixUI, sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-sub {
  color: var(--muted-2);
  font-size: 0.82rem;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(17, 30, 54, 0.82);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 10px;
}

#userAvatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #172641;
}

.user-name {
  font-weight: 700;
  line-height: 1.1;
}

.logout-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0;
}

.logout-btn:hover {
  color: #fff;
}

.section-title {
  color: #f8fcff;
  font-family: SpotifyMixUITitle, SpotifyMixUI, sans-serif;
  font-size: 0.97rem;
  font-weight: 800;
}

.session-box {
  background: rgba(15, 25, 44, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.87rem;
}

.session-row b {
  color: #f8fcff;
  font-size: 0.83rem;
  max-width: 168px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 7px 12px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: all 0.18s ease;
}

.status-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 currentColor;
  }
  70% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

.status-pill.status-ok {
  color: #022635;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: rgba(255, 255, 255, 0.35);
}

.status-pill.status-error {
  color: #2b030d;
  background: linear-gradient(135deg, #ffd7de, #ff8192);
  border-color: rgba(255, 255, 255, 0.3);
}

.status-pill.status-info {
  color: #05334b;
  background: linear-gradient(135deg, #c6f5ff, #84eaff);
  border-color: rgba(255, 255, 255, 0.32);
}

.spotify-user-panel {
  background: rgba(14, 25, 46, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spotify-user-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spotify-user-head h3 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
}

.spotify-user-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.spotify-tabs {
  display: flex;
  gap: 8px;
}

.spotify-library-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.spotify-lib-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  border-radius: 10px;
  background: rgba(16, 29, 51, 0.9);
  border: 1px solid rgba(107, 151, 222, 0.28);
  padding: 8px;
  transition: all 0.18s ease;
}

.spotify-lib-item:hover {
  background: rgba(25, 42, 72, 0.96);
  border-color: rgba(139, 196, 255, 0.42);
}

.spotify-lib-item img {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  background: #1f3457;
}

.spotify-lib-title {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-lib-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.spotify-lib-actions {
  margin-top: 8px;
}

.spotify-liked-bulk {
  border: 1px dashed rgba(113, 176, 255, 0.45);
  border-radius: 10px;
  padding: 12px;
  background: rgba(13, 22, 41, 0.9);
}

.queue-author {
  color: var(--muted);
  font-size: 0.86rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid rgba(123, 175, 255, 0.22);
  background: linear-gradient(180deg, rgba(24, 41, 73, 0.95) 0%, rgba(16, 27, 49, 0.92) 100%);
}

.home-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(11, 21, 40, 0.96);
  border: 1px solid rgba(123, 178, 255, 0.34);
  color: #d8eeff;
  font-size: 1.2rem;
}

.home-dot svg {
  width: 19px;
  height: 19px;
}

.search-area {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 238px 98px 118px;
  gap: 8px;
  width: 100%;
}

#searchInput,
.search-source,
.btn,
.ctl,
.queue-action-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
}

#searchInput,
.search-source {
  background: rgba(12, 24, 44, 0.9);
  color: #fff;
  height: 40px;
  padding: 0 14px;
  border-color: rgba(106, 159, 239, 0.28);
}

#searchInput::placeholder {
  color: #9bb5d6;
}

#searchInput:focus,
.search-source:focus {
  outline: none;
  border-color: rgba(91, 219, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(39, 211, 255, 0.17);
}

.source-picker {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  height: 40px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(12, 24, 44, 0.9);
  border: 1px solid rgba(106, 159, 239, 0.28);
}

.source-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.source-option svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.source-option.active {
  background: rgba(39, 211, 255, 0.14);
  color: #f5fcff;
  box-shadow: inset 0 0 0 1px rgba(126, 226, 255, 0.4);
}

.source-native {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.btn,
.ctl,
.queue-action-btn,
.icon-btn {
  cursor: pointer;
  height: 40px;
  padding: 0 14px;
  color: #f6fbff;
  background: rgba(13, 24, 45, 0.9);
  border-color: rgba(108, 156, 230, 0.24);
  transition: all 0.18s ease;
}

.btn:hover,
.ctl:hover,
.queue-action-btn:hover,
.icon-btn:hover {
  background: rgba(29, 45, 77, 0.95);
  border-color: rgba(130, 200, 255, 0.42);
}

.btn:focus-visible,
.ctl:focus-visible,
.queue-action-btn:focus-visible,
.icon-btn:focus-visible,
.source-option:focus-visible,
.chip:focus-visible,
.song-card button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(39, 211, 255, 0.22);
  border-color: rgba(117, 224, 255, 0.82);
}

.btn.primary,
.ctl.main {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #052335;
  border-color: rgba(202, 244, 255, 0.82);
  font-weight: 800;
}

.btn.primary:hover,
.ctl.main:hover {
  background: linear-gradient(135deg, #b4f4ff, #52ddff);
}

.ctl.danger,
.queue-action-btn.danger,
.icon-btn.danger {
  border-color: rgba(255, 123, 148, 0.48);
  color: #ffc5d0;
}

.ctl.danger:hover,
.queue-action-btn.danger:hover,
.icon-btn.danger:hover {
  background: rgba(57, 20, 31, 0.95);
  border-color: rgba(255, 141, 162, 0.72);
}

.discover-chips {
  padding: 12px;
  border-bottom: 1px solid rgba(123, 175, 255, 0.16);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  border: 1px solid rgba(120, 168, 234, 0.3);
  border-radius: 999px;
  background: rgba(10, 18, 35, 0.75);
  color: var(--muted);
  height: 33px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
}

.chip:hover {
  color: #fff;
  background: rgba(25, 39, 67, 0.92);
  border-color: rgba(154, 204, 255, 0.56);
}

.content-section {
  overflow: auto;
  padding: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-family: SpotifyMixUITitle, SpotifyMixUI, sans-serif;
  font-size: 1.35rem;
}

.section-head span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.discover-wrap {
  display: grid;
  gap: 20px;
}

.discover-row h4 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #e7f2ff;
}

.discover-grid,
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.song-card {
  background: rgba(15, 25, 46, 0.92);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid rgba(112, 162, 233, 0.24);
  transition: all 0.2s ease;
  cursor: pointer;
}

.song-card:hover {
  background: rgba(27, 44, 75, 0.97);
  border-color: rgba(149, 206, 255, 0.46);
  transform: translateY(-2px);
}

.song-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #24385b;
}

.song-title {
  margin-top: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  min-height: 2.2em;
  overflow: hidden;
}

.song-artist,
.song-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-card button {
  margin-top: 10px;
  width: 100%;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(160, 227, 255, 0.72);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #072539;
  font-weight: 800;
  cursor: pointer;
}

.song-card button:hover {
  background: linear-gradient(135deg, #b5f4ff, #51dcff);
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-head h3 {
  margin: 0;
  font-size: 1.03rem;
  font-family: SpotifyMixUITitle, SpotifyMixUI, sans-serif;
}

.queue-list {
  flex: 1;
  overflow: auto;
  display: grid;
  align-content: start;
  grid-auto-rows: min-content;
  gap: 8px;
  padding-right: 2px;
}

.queue-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 9px;
  background: rgba(16, 29, 51, 0.93);
  border: 1px solid rgba(105, 151, 224, 0.29);
  border-radius: 10px;
  padding: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.queue-item:hover {
  background: rgba(28, 44, 73, 0.96);
  border-color: rgba(142, 194, 255, 0.45);
}

.queue-item img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: #22375b;
}

.queue-title {
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-actions {
  margin-top: 5px;
  display: flex;
  gap: 6px;
}

.queue-action-btn {
  height: 26px;
  padding: 0 9px;
  font-size: 0.7rem;
}

.player-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 92px;
  background: rgba(5, 10, 20, 0.95);
  border-top: 1px solid rgba(124, 177, 255, 0.26);
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(360px, 1fr) minmax(270px, 340px);
  gap: 16px;
  align-items: center;
  padding: 9px 18px;
  z-index: 20;
  backdrop-filter: blur(7px);
}

.player-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}

.np-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #1c2d4b;
}

.np-title {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.2;
}

.np-artist {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.effect-label {
  color: var(--muted-2);
  font-size: 0.76rem;
  margin-top: 4px;
}

.player-center {
  display: grid;
  gap: 8px;
}

.spotify-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-btn {
  height: 38px;
  min-width: 38px;
  width: 38px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d5e9ff;
  background: transparent;
  border-color: transparent;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn.play-main {
  width: 48px;
  min-width: 48px;
  height: 48px;
  color: #06273c;
  background: linear-gradient(135deg, #d9fbff, #6ce5ff);
  border-color: rgba(212, 249, 255, 0.92);
}

.icon-btn.play-main:hover {
  background: linear-gradient(135deg, #ecfdff, #80e9ff);
  transform: scale(1.03);
}

.icon-btn.play-main .icon-play,
.icon-btn.play-main .icon-pause {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.icon-btn.play-main .icon-pause {
  display: none;
}

.icon-btn.play-main.is-playing .icon-play {
  display: none;
}

.icon-btn.play-main.is-playing .icon-pause {
  display: block;
}

.loop-btn {
  position: relative;
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.loop-state {
  position: absolute;
  right: -8px;
  bottom: -3px;
  min-width: 25px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(39, 211, 255, 0.17);
  color: #c9f6ff;
  border: 1px solid rgba(115, 224, 255, 0.4);
  font-size: 0.66rem;
  font-weight: 800;
}

.compact-controls {
  justify-content: flex-start;
}

.seek-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  width: min(620px, 100%);
  margin: 0 auto;
}

.seek-row span {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
  white-space: nowrap;
}

.player-right {
  display: grid;
  gap: 8px;
}

.volume-row {
  display: grid;
  grid-template-columns: 20px 54px 42px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.volume-icon {
  width: 17px;
  height: 17px;
  color: #d5e9ff;
}

.volume-row span {
  color: var(--muted);
  font-size: 0.78rem;
}

.volume-label {
  font-weight: 700;
}

#volumeText {
  text-align: right;
  white-space: nowrap;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.quick-actions .ctl {
  height: 34px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.action-btn svg {
  width: 14px;
  height: 14px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(141, 175, 220, 0.35);
  border-radius: 999px;
  outline: none;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 0;
  background: #d7fbff;
  cursor: pointer;
}

input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #d7fbff;
  cursor: pointer;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, #143159 0%, #05090f 60%);
}

.auth-card {
  width: min(440px, 92vw);
  background: rgba(10, 19, 35, 0.95);
  border-radius: 16px;
  border: 1px solid rgba(122, 180, 255, 0.35);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-family: SpotifyMixUITitle, SpotifyMixUI, sans-serif;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.discord-login {
  display: inline-flex;
  height: 42px;
  align-items: center;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  background: linear-gradient(135deg, #b5f4ff, #52dcff);
  border: 1px solid rgba(212, 248, 255, 0.85);
  color: #072739;
  font-weight: 800;
}

.join-popup {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 80;
}

.join-popup-card {
  width: 320px;
  background: rgba(13, 22, 40, 0.95);
  border: 1px solid rgba(123, 176, 255, 0.44);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px;
}

.join-popup-title {
  font-size: 0.92rem;
  font-weight: 800;
}

.join-popup-text {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.toast-viewport {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 130;
  width: min(360px, calc(100vw - 28px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.join-popup:not(.hidden) + .toast-viewport {
  top: 104px;
}

.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 11px 10px 11px 12px;
  border-radius: 12px;
  background: rgba(10, 20, 38, 0.96);
  border: 1px solid rgba(126, 183, 255, 0.34);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  animation: toast-in 180ms ease-out;
}

.toast.closing {
  animation: toast-out 180ms ease-in forwards;
}

.toast-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(39, 211, 255, 0.65);
}

.toast-error .toast-mark {
  background: var(--danger);
  box-shadow: 0 0 14px rgba(255, 100, 122, 0.6);
}

.toast-message {
  color: #f4fbff;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.toast-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.toast-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

.version-popup-overlay,
.lyrics-panel {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 12, 0.82);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.version-popup-card,
.lyrics-card {
  position: relative;
  width: min(900px, 95vw);
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(11, 21, 39, 0.97), rgba(8, 14, 28, 0.98));
  border: 1px solid rgba(126, 183, 255, 0.28);
  box-shadow: var(--shadow-lg);
  padding: 18px;
}

.lyrics-card.compact {
  max-width: 620px;
}

.version-badge {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(39, 211, 255, 0.18);
  color: #a4efff;
  border: 1px solid rgba(127, 226, 255, 0.42);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
}

.version-popup-card h2 {
  margin: 8px 0 6px;
  font-family: SpotifyMixUITitle, SpotifyMixUI, sans-serif;
}

.version-popup-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.version-list {
  margin: 12px 0 16px;
  padding-left: 20px;
  color: #e8f3ff;
  display: grid;
  gap: 6px;
}

.version-confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -8px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall 1.8s linear infinite;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-8px) rotate(0deg);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform: translateY(340px) rotate(260deg);
    opacity: 0;
  }
}

.lyrics-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.lyrics-title {
  font-family: SpotifyMixUITitle, SpotifyMixUI, sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
}

.lyrics-track-label {
  color: var(--muted);
  margin-top: 4px;
}

.lyrics-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 310px;
  gap: 12px;
}

.lyrics-body {
  min-height: 60vh;
  max-height: 72vh;
  overflow: auto;
  border: 1px solid rgba(115, 170, 246, 0.33);
  border-radius: 10px;
  background: rgba(12, 20, 36, 0.88);
  padding: 12px;
}

.lyrics-lines {
  display: grid;
  gap: 8px;
}

.lyric-line {
  color: #89a1c4;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.18;
  transition: color 120ms ease, opacity 120ms ease;
}

.lyric-line.active {
  color: #f4fbff;
}

.lyric-line.dimmed {
  color: #667a9c;
}

.lyrics-player {
  border: 1px solid rgba(108, 162, 240, 0.3);
  border-radius: 10px;
  background: rgba(10, 18, 33, 0.9);
  padding: 12px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.lyrics-np-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #20365b;
}

.track-info-card {
  max-width: 760px;
}

.track-info-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.track-info-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  object-fit: cover;
  background: #20365b;
}

.track-info-grid {
  display: grid;
  gap: 9px;
}

.track-info-row {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(106, 164, 244, 0.26);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(13, 22, 39, 0.82);
}

.track-info-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

.track-info-row b {
  color: #edf7ff;
  font-size: 0.89rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.track-info-link a {
  color: #b8eeff;
  text-decoration: none;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.track-info-link a:hover {
  color: #dbf7ff;
  text-decoration: underline;
}

.track-info-link a.disabled {
  color: var(--muted-2);
  text-decoration: none;
  pointer-events: none;
}

.effects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.effects-grid .ctl {
  border-radius: 10px;
}

.effects-grid .ctl.active {
  color: #06283c;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: rgba(212, 249, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(39, 211, 255, 0.12);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(114, 156, 212, 0.62);
  border-radius: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1560px) {
  .spotify-shell {
    grid-template-columns: 290px 1fr 320px;
  }
}

@media (max-width: 1320px) {
  .spotify-shell {
    grid-template-columns: 280px 1fr;
  }

  .right-col {
    display: none;
  }

  .player-footer {
    grid-template-columns: 280px 1fr 300px;
  }
}

@media (max-width: 1024px) {
  html,
  body {
    overflow: auto;
  }

  .app {
    min-height: 100svh;
    padding: 6px;
    padding-bottom: 184px;
  }

  .spotify-shell {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 10px;
  }

  .left-col,
  .center-col,
  .right-col {
    min-height: 0;
    overflow: visible;
  }

  .left-col {
    max-height: none;
    padding: 10px;
    gap: 10px;
  }

  .center-col {
    min-height: 52vh;
  }

  .right-col {
    display: flex;
    min-height: 220px;
    max-height: 40vh;
  }

  .queue-list {
    max-height: calc(40vh - 58px);
  }

  .player-footer {
    height: auto;
    max-height: none;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .player-left,
  .player-center,
  .player-right {
    width: 100%;
    min-width: 0;
  }

  .player-left {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
  }

  .np-thumb {
    width: 56px;
    height: 56px;
  }

  .search-area {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'input input'
      'source source'
      'search play';
  }

  #searchInput {
    grid-area: input;
  }

  .source-picker {
    grid-area: source;
  }

  #searchBtn {
    grid-area: search;
  }

  #playBtn {
    grid-area: play;
  }

  .lyrics-layout {
    grid-template-columns: 1fr;
  }

  .track-info-layout {
    grid-template-columns: 1fr;
  }

  .track-info-thumb {
    max-width: 220px;
  }

  .lyrics-body {
    min-height: 48vh;
    max-height: 55vh;
  }

  .lyric-line {
    font-size: 1.62rem;
  }

  .seek-row {
    width: 100%;
    margin: 0;
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .spotify-controls {
    gap: 8px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .quick-actions .ctl {
    min-width: 0;
    padding: 0 8px;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 6px;
    padding-bottom: 220px;
  }

  .panel,
  .lyrics-card,
  .version-popup-card {
    border-radius: 12px;
  }

  .left-col {
    padding: 10px;
    gap: 10px;
  }

  .top-nav {
    padding: 10px;
    align-items: flex-start;
  }

  .home-dot {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .discover-grid,
  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .song-card {
    padding: 10px;
  }

  .player-footer {
    padding: 8px 10px;
  }

  .np-thumb {
    width: 52px;
    height: 52px;
  }

  .icon-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .icon-btn.play-main {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .loop-btn {
    width: 34px;
    min-width: 34px;
  }

  .loop-state {
    right: -10px;
    bottom: -5px;
    transform: scale(0.9);
  }

  .volume-row {
    grid-template-columns: 18px 50px 38px minmax(0, 1fr);
    gap: 6px;
  }

  .quick-actions .ctl {
    height: 32px;
    font-size: 0.74rem;
  }

  .lyrics-card {
    width: 100%;
    max-height: 92svh;
    overflow: auto;
    padding: 12px;
  }

  .lyrics-body {
    min-height: 40svh;
    max-height: none;
  }

  .track-info-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .action-btn span {
    font-size: 0.73rem;
  }

  .join-popup {
    right: 10px;
    left: 10px;
    top: 10px;
  }

  .join-popup-card {
    width: 100%;
  }

  .toast-viewport {
    top: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .join-popup:not(.hidden) + .toast-viewport {
    top: 92px;
  }
}

@media (max-width: 560px) {
  .app {
    padding-bottom: 232px;
  }

  .search-area {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }

  #searchInput,
  .source-picker,
  #searchBtn,
  #playBtn {
    grid-area: auto;
    width: 100%;
  }

  .section-head h2 {
    font-size: 1.12rem;
  }

  .player-left {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px;
  }

  .np-thumb {
    width: 46px;
    height: 46px;
  }

  .np-artist,
  .effect-label {
    display: none;
  }

  .icon-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .icon-btn.play-main {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .seek-row {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .seek-row span {
    font-size: 0.72rem;
  }

  .volume-row {
    grid-template-columns: 16px 44px 34px minmax(0, 1fr);
  }

  .volume-row span {
    font-size: 0.72rem;
  }

  .action-btn {
    gap: 0;
  }

  .action-btn span {
    display: none;
  }
}

@media (max-width: 420px) {
  .discover-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }
}
