:root {
  --bg-1: #000000;
  --bg-2: #000000;
  --accent: #000000;
  --text: #FFFFFF;
  --muted: #c8c8d0;
  --border: rgba(255,255,255,0.12);
  --card: rgba(255,255,255,0.06);
  --gold-1: #ffcc00;
  --gold-2: #ffd700;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 50px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-2), var(--accent));
  background-size: 300% 300%;
  animation: gradientAnimation 16s ease infinite;
  overflow-x: hidden;
}

@keyframes gradientAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== Background layers (stay behind everything) ===== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: 50% 50%;
  filter: blur(40px) brightness(0.65) saturate(1.2);
  transform: scale(1.18);
  transition: opacity 600ms ease;
  opacity: 1;
  will-change: opacity;
}
.bg-layer.hidden { opacity: 0; }

/* ===== Idle / Screensaver ===== */
#idle-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;                 /* above site & toast */
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;         /* use visibility so opacity transitions work */
  transition: opacity .35s ease, visibility .35s ease;
  pointer-events: none;       /* global listeners wake it */
}

/* big centered art card */
#idle-overlay .idle-center {
  pointer-events: auto;       /* can allow clicks here if you want */
  width: min(58vh, 520px);
  height: min(58vh, 520px);
  border-radius: 22px;
  overflow: hidden;
  box-shadow:
    0 40px 120px rgba(0,0,0,.55),
    0 2px 0 rgba(255,255,255,.04) inset;
  backdrop-filter: blur(2px);
}
#idle-overlay #idle-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.02) saturate(1.02);
}

/* bottom-left track text */
#idle-overlay .idle-meta {
  position: fixed;
  left: 52px;
  bottom: 46px;
  color: #fff;
  text-shadow: 0 6px 28px rgba(0,0,0,.55);
  max-width: min(60vw, 720px);
  line-height: 1.15;
}
#idle-overlay #idle-title {
  font-weight: 700;
  font-size: clamp(18px, 2.2vw + 8px, 28px);
  letter-spacing: .2px;
}
#idle-overlay #idle-artist {
  opacity: .9;
  font-size: clamp(12px, 1.2vw + 6px, 16px);
}

/* show overlay in idle */
body.idle #idle-overlay {
  opacity: 1;
  visibility: visible;
}

/* softly fade out main UI (site + toast only) */
.site { position: relative; z-index: 1; transition: opacity .25s ease, visibility .25s ease, transform .25s ease; }
#toast { z-index: 3; position: fixed; transition: opacity .25s ease, visibility .25s ease; } /* keep on top during normal mode */

body.idle .site,
body.idle #toast {
  opacity: 0;
  visibility: hidden;
  transform: scale(.985);
  transition: opacity .25s ease, visibility .25s ease, transform .25s ease;
  pointer-events: none;
}

/* ===== Layout / UI ===== */
.site {
  display: flex;
  flex-direction: column;
  align-items: center; /* header stays centered */
  width: 100%;
}

/* Header stays lightweight, separate from cards */
header[role="banner"] {
  text-align: center;
  margin-top: 60px;
  animation: fadeIn 1.5s ease forwards;
  background: linear-gradient(to bottom, rgba(255,255,255,0.03), transparent 70%);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  padding-bottom: 8px;
  isolation: isolate;
  contain: layout paint;
}

/* Center the small button row without changing HTML */
header[role="banner"] > div[style*="margin-top"] {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  backdrop-filter: blur(10px) saturate(1.05);
}

.title {
  font-size: clamp(2rem, 3.2vw + 1rem, 3.25rem);
  margin: 0;
  letter-spacing: .4px;
  opacity: 0;
  transform: translateY(-50px) rotateX(40deg) scale(0.9);
  animation: titleSwoop 1.5s ease-out forwards;
  animation-delay: 0.3s;
}

.title--gold {
  background: linear-gradient(90deg, var(--gold-1), var(--gold-2), var(--gold-1));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 18px rgba(255, 204, 0, .25);
  animation: shimmer 2s infinite ease-in-out;
}

.subtle {
  color: var(--muted);
  margin: 0;
  font-size: clamp(1rem, 1vw + .7rem, 1.2rem);
  opacity: 0;
  animation: fadeIn 2s ease forwards;
  animation-delay: 1.2s;
}

.rarity {
  display: none;
  color: var(--gold-1);
  font-weight: 600;
  margin-top: 8px;
  opacity: 0;
  animation: fadeIn 1s ease forwards;
  animation-delay: 1.5s;
}

main[role="main"] {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
  width: 100%;
  margin-top: 40px;
}

/* ---------------- Cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .3s ease, box-shadow .3s ease;
  width: min(96vw, 1900px);
  margin: 0 auto;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card__body { padding: 16px; }

.card__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card__title { margin: 0; font-size: 1.05rem; letter-spacing: .2px; }

/* --------------- Player / List --------------- */
/* Sidebar + player: responsive columns, player gets the rest */
.player-layout {
  display: grid;
  grid-template-columns: clamp(240px, 20vw, 380px) 1fr;
  gap: 20px;
  width: 100%;
  align-items: start;
}

.sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: clamp(300px, 68vh, 760px);
  overflow: hidden;
}

.sidebar__search { padding: 10px; border-bottom: 1px solid var(--border); }
.sidebar__search input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.sidebar__list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow: auto;
  flex: 1;
}
.sidebar__list li {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s ease, transform .1s ease;
}
.sidebar__list li:hover { background: rgba(255,255,255,.06); }
.sidebar__list li[aria-selected="true"] {
  background: rgba(255,255,255,.10);
  outline: 1px solid var(--border);
}

#game-iframe {
  width: 100%;
  height: clamp(380px, 70vh, 920px);
  border: 0;
  display: block;
  border-radius: calc(var(--radius) - 2px);
  aspect-ratio: auto;
}

/* --------------- Tables --------------- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
}
tbody td { padding: 12px; border-top: 1px solid var(--border); }
tbody tr { transition: background 0.3s ease; }
tbody tr:hover { background: rgba(255,255,255,.04); }

.rank { width: 64px; text-align: right; color: var(--muted); }
.score { text-align: right; font-variant-numeric: tabular-nums; }

.slotting { filter: blur(0.6px) contrast(1.1); }
.slot-complete { text-shadow: 0 0 10px rgba(255,255,255,.25); }

footer {
  text-align: center;
  color: var(--muted);
  margin: 40px 0;
  opacity: 0;
  animation: fadeIn 2s ease forwards;
  animation-delay: 2.2s;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer {
  0% { text-shadow: 0 0 10px rgba(255, 204, 0, 0.5); }
  50% { text-shadow: 0 0 25px rgba(255, 204, 0, 1); }
  100% { text-shadow: 0 0 10px rgba(255, 204, 0, 0.5); }
}
@keyframes titleSwoop {
  0% { opacity: 0; transform: translateY(-50px) rotateX(40deg) scale(0.9); }
  60% { opacity: 1; transform: translateY(20px) rotateX(0deg) scale(1.05); }
  100% { transform: translateY(0) rotateX(0deg) scale(1); opacity: 1; }
}

/* --------------- Responsive --------------- */
@media (max-width: 980px) {
  .player-layout { grid-template-columns: 1fr; }
  .sidebar { max-height: 40vh; }
  #game-iframe { height: 60vh; aspect-ratio: auto; }
}

/* Jamie motif long text */
.card__title.motif {
  white-space: normal;
  line-height: 1.25;
  font-weight: 600;
}
/* ============================================================
   SPOTIFY PANEL — append this to the bottom of style.css
   ============================================================ */

/* ===== Panel backdrop ===== */
#sp-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
#sp-panel-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ===== Panel itself ===== */
#sp-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  width: min(400px, 92vw);
  background: rgba(12, 12, 16, 0.88);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.4, 0, .2, 1);
  box-shadow: -12px 0 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
#sp-panel.is-open {
  transform: translateX(0);
}

/* ===== Panel header ===== */
.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.sp-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .3px;
  color: #fff;
}
.sp-header-logo {
  width: 22px;
  height: 22px;
  /* Spotify green circle icon via inline SVG bg */
  background: #1DB954;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
#sp-panel-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  padding: 6px 10px;
  font-size: .85rem;
  transition: background .2s ease;
  line-height: 1;
}
#sp-panel-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ===== Scrollable body ===== */
.sp-body {
  overflow-y: auto;
  flex: 1;
  padding: 0 0 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sp-body::-webkit-scrollbar { width: 4px; }
.sp-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* ===== Section labels ===== */
.sp-section {
  padding: 18px 20px 6px;
}
.sp-section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 10px;
}

/* ===== Now Playing card ===== */
.sp-now-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
}
.sp-now-art {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.sp-now-info {
  flex: 1;
  min-width: 0;
}
.sp-now-title {
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.sp-now-artist {
  font-size: .82rem;
  color: rgba(255,255,255,.7);
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-now-album {
  font-size: .75rem;
  color: rgba(255,255,255,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
.sp-progress-bar {
  height: 3px;
  background: rgba(255,255,255,.15);
  border-radius: 2px;
  overflow: hidden;
}
.sp-progress-fill {
  height: 100%;
  background: #1DB954;
  border-radius: 2px;
  transition: width .5s linear;
}
.sp-progress-time {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: rgba(255,255,255,.4);
  margin-top: 4px;
}

/* ===== Track rows (recent, playlists) ===== */
.sp-track-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background .18s ease;
  cursor: default;
}
.sp-track-row:hover {
  background: rgba(255,255,255,.06);
}
.sp-track-art {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.sp-track-art--circle {
  border-radius: 50%;
}
.sp-art-placeholder {
  background: rgba(255,255,255,.08);
}
.sp-track-info {
  flex: 1;
  min-width: 0;
}
.sp-track-name {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.sp-track-sub {
  font-size: .75rem;
  color: rgba(255,255,255,.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* ===== Play button on rows ===== */
.sp-play-btn {
  flex-shrink: 0;
  background: rgba(29, 185, 84, 0.15);
  border: 1px solid rgba(29, 185, 84, 0.25);
  color: #1DB954;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .8rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease;
}
.sp-track-row:hover .sp-play-btn {
  opacity: 1;
}
.sp-play-btn:hover {
  background: rgba(29, 185, 84, 0.3);
}

/* ===== Loading / empty states ===== */
.sp-loading {
  font-size: .82rem;
  color: rgba(255,255,255,.35);
  padding: 12px 10px;
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .35; }
  50%       { opacity: .7; }
}
.sp-empty {
  font-size: .82rem;
  color: rgba(255,255,255,.35);
  padding: 8px 10px;
  margin: 0;
}
.sp-reauth-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  padding: 4px 10px;
  font-size: .8rem;
  margin-top: 4px;
}
.sp-reauth-btn:hover { background: rgba(255,255,255,.18); }

/* ===== Divider between sections ===== */
.sp-divider {
  height: 1px;
  background: rgba(255,255,255,.06);
  margin: 4px 20px 0;
}

/* ===== Open panel button (in header) ===== */
#sp-panel-open {
  background: rgba(29, 185, 84, 0.15);
  color: #1DB954;
  border: 1px solid rgba(29, 185, 84, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
#sp-panel-open:hover {
  transform: translateY(-2px);
  background: rgba(29, 185, 84, 0.25);
  box-shadow: 0 6px 25px rgba(29, 185, 84, 0.25);
}

/* ===== Favorites ===== */
.sidebar__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-game-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.25);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 2px 0 8px;
  flex-shrink: 0;
  transition: color .15s ease, transform .15s ease;
  line-height: 1;
}
.fav-btn:hover { color: var(--gold-1); transform: scale(1.2); }
.fav-btn--on   { color: var(--gold-1); }


/* ============================================================
   MEJIRO MCQUEEN CURSE
   ============================================================ */
#mcqueen-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #000;
  user-select: none;
  -webkit-user-select: none;
}

/* Fake loader */
#mcqueen-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #0d0d0d;
}

#mcqueen-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 340px;
}

#mcqueen-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.12);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mcq-spin 0.85s linear infinite;
}

@keyframes mcq-spin {
  to { transform: rotate(360deg); }
}

#mcqueen-title {
  color: #fff;
  font-size: 1.1rem;
  font-family: inherit;
  margin: 0;
  letter-spacing: 0.02em;
}

#mcqueen-dots::after {
  content: '';
  animation: mcq-dots 1.2s steps(4, end) infinite;
}

@keyframes mcq-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

#mcqueen-bar-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  overflow: hidden;
}

#mcqueen-bar {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.5s ease;
}

#mcqueen-status {
  color: rgba(255,255,255,0.45);
  font-size: 0.78rem;
  font-family: monospace;
  margin: 0;
}

/* Video */
#mcqueen-video-wrap {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: #000;
}

#mcqueen-video {
  width: 100%;
  height: 100%;
  border: none;
}


/* ============================================================
   POLISH PASS
   ============================================================ */

/* ----- Font refinements ----- */
/* Tighten up body text rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Slightly looser tracking on headings for breathing room */
.title        { letter-spacing: -.01em; }
.card__title  { letter-spacing: .01em; font-size: 1rem; }
.sp-section-label { letter-spacing: 1.4px; }

/* ----- Smoother global transitions ----- */
/* Give interactive elements a consistent snappy feel */
a, button, [role="button"], [tabindex] {
  transition:
    background   .18s ease,
    color        .18s ease,
    border-color .18s ease,
    opacity      .18s ease,
    transform    .18s ease,
    box-shadow   .18s ease;
}

/* Card lift — softer spring feel */
.card {
  transition: transform .25s cubic-bezier(.22,.68,0,1.2), box-shadow .25s ease;
  will-change: transform;
}
.card:hover { transform: translateY(-4px); }

/* Sidebar items */
.sidebar__list li {
  transition: background .15s ease, transform .12s ease;
}
.sidebar__list li:hover { transform: translateX(2px); }
.sidebar__list li[aria-selected="true"] { transform: none; }

/* Spotify panel slide — slightly springier */
#sp-panel {
  transition: transform .3s cubic-bezier(.22,.68,0,1.15);
}

/* ----- Button :active press states ----- */
button:active,
[role="button"]:active {
  transform: scale(.96) !important;
  opacity: .85;
}

/* Header buttons */
#spotify-connect,
#ambient-toggle,
#sp-panel-open,
#open-blank {
  transition:
    transform    .18s ease,
    box-shadow   .18s ease,
    background   .18s ease,
    border-color .18s ease;
}
#spotify-connect:hover,
#ambient-toggle:hover,
#open-blank:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
#spotify-connect:active,
#ambient-toggle:active,
#sp-panel-open:active,
#open-blank:active {
  transform: translateY(0) scale(.97) !important;
  box-shadow: none;
}

/* Toast control buttons */
#btn-restart:active,
#btn-playpause:active,
#btn-next:active {
  transform: scale(.92) !important;
}

/* Fav star */
.fav-btn:active { transform: scale(1.4) !important; }

/* Spotify play btn */
.sp-play-btn:active { transform: scale(.9) !important; }

/* ----- Custom scrollbars (sidebar + spotify panel) ----- */
/* Firefox */
.sidebar__list,
.sp-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

/* WebKit */
.sidebar__list::-webkit-scrollbar,
.sp-body::-webkit-scrollbar {
  width: 4px;
}
.sidebar__list::-webkit-scrollbar-track,
.sp-body::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar__list::-webkit-scrollbar-thumb,
.sp-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  transition: background .2s ease;
}
.sidebar__list::-webkit-scrollbar-thumb:hover,
.sp-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.25);
}

/* Search input focus state */
.sidebar__search input {
  outline: none;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.sidebar__search input:focus {
  border-color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.12);
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}

/* ----- Nicer loading states ----- */
/* Replace flat pulse with a shimmer sweep */
@keyframes sp-shimmer {
  0%   { background-position: -300px 0; }
  100% { background-position:  300px 0; }
}

.sp-loading {
  font-size: .82rem;
  color: transparent;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.15) 25%,
    rgba(255,255,255,.3)  50%,
    rgba(255,255,255,.15) 75%
  );
  background-size: 600px 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: sp-shimmer 1.6s ease infinite;
  padding: 12px 10px;
  user-select: none;
}

/* Skeleton placeholder rows while loading */
.sp-skeleton {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
}
.sp-skeleton-art {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  flex-shrink: 0;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.06) 25%,
    rgba(255,255,255,.12) 50%,
    rgba(255,255,255,.06) 75%
  );
  background-size: 600px 100%;
  animation: sp-shimmer 1.6s ease infinite;
}
.sp-skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sp-skeleton-line {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.06) 25%,
    rgba(255,255,255,.12) 50%,
    rgba(255,255,255,.06) 75%
  );
  background-size: 600px 100%;
  animation: sp-shimmer 1.6s ease infinite;
}
.sp-skeleton-line--short { width: 55%; }

/* Smooth image loads */
.sp-track-art,
.sp-now-art {
  transition: opacity .3s ease;
}


/* ============================================================
   MUSIC MODE
   ============================================================ */

#music-mode-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
#music-mode-btn:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.2);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}

/* Overlay */
#music-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  gap: 0;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: music-fadein .35s ease forwards;
}
@keyframes music-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Hide site while music mode is active */
body.music-mode .site,
body.music-mode #toast {
  opacity: 0;
  pointer-events: none;
}

/* Exit button */
#music-exit {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 10;
  transition: background .18s ease, transform .18s ease;
}
#music-exit:hover {
  background: rgba(255,255,255,.2);
  transform: translateY(-1px);
}

/* Layout: now playing left, queue right */
#music-overlay {
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 60px;
  padding: 40px;
}

/* Now playing panel */
#music-now {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: min(380px, 40vw);
}

#music-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 20px;
  object-fit: cover;
  box-shadow:
    0 40px 120px rgba(0,0,0,.7),
    0 0 0 1px rgba(255,255,255,.06);
  transition: opacity .4s ease;
  background: rgba(255,255,255,.05);
}

#music-track-info {
  text-align: center;
  width: 100%;
}
#music-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#music-artist {
  font-size: .95rem;
  color: rgba(255,255,255,.7);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#music-album {
  font-size: .8rem;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress */
#music-progress-wrap { width: 100%; }
#music-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
}
#music-progress-bar:hover { height: 6px; margin: -1px 0; }
#music-progress-fill {
  height: 100%;
  background: #1DB954;
  border-radius: 999px;
  transition: width .8s linear;
}
#music-progress-times {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: rgba(255,255,255,.4);
  margin-top: 6px;
}

/* Controls */
#music-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.music-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s ease, transform .18s ease;
  flex-shrink: 0;
}
.music-btn:hover { background: rgba(255,255,255,.2); transform: scale(1.08); }
.music-btn:active { transform: scale(.92) !important; }
.music-btn--sm {
  width: 36px;
  height: 36px;
  font-size: .85rem;
  background: transparent;
  border-color: rgba(255,255,255,.1);
}
.music-btn--lg {
  width: 60px;
  height: 60px;
  font-size: 1.4rem;
  background: #fff;
  color: #000;
  border: none;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
.music-btn--lg:hover { background: rgba(255,255,255,.9); }
.music-btn--active {
  color: #1DB954 !important;
  border-color: rgba(29,185,84,.4) !important;
}

/* Queue panel */
#music-queue-panel {
  width: min(300px, 28vw);
  height: min(500px, 70vh);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#music-queue-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
#music-queue-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
#music-queue-list::-webkit-scrollbar { width: 3px; }
#music-queue-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 999px; }

.music-queue-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  transition: background .15s ease;
}
.music-queue-row:hover { background: rgba(255,255,255,.07); }
.music-queue-art {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
}
.music-queue-info { flex: 1; min-width: 0; }
.music-queue-name {
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-queue-artist {
  font-size: .72rem;
  color: rgba(255,255,255,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-queue-empty {
  font-size: .82rem;
  color: rgba(255,255,255,.3);
  padding: 12px 8px;
}

/* Responsive */
@media (max-width: 800px) {
  #music-overlay {
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    align-items: center;
    justify-content: flex-start;
    padding-top: 70px;
  }
  #music-now { width: min(300px, 80vw); }
  #music-queue-panel { width: min(300px, 80vw); height: 220px; }
}


/* ============================================================
   MUSIC MODE
   ============================================================ */
#music-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  grid-template-columns: 1fr 340px;
  background: #000;
  opacity: 0;
  transition: opacity .35s ease;
}
#music-overlay.is-visible {
  display: grid;
  opacity: 1;
}
#music-overlay.is-entering {
  opacity: 1;
}

/* Blurred album art fills the whole background */
#music-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--music-art-url, none);
  background-size: cover;
  background-position: center;
  filter: blur(60px) brightness(0.35) saturate(1.3);
  transform: scale(1.1);
  transition: background-image .6s ease;
}

/* Exit button */
#music-exit {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .18s ease, transform .18s ease;
}
#music-exit:hover {
  background: rgba(255,255,255,.2);
  transform: translateY(-1px);
}

/* Left panel — now playing */
#music-now {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 60px 60px 60px 80px;
}

/* Album art */
#music-art {
  width: clamp(220px, 30vw, 420px);
  height: clamp(220px, 30vw, 420px);
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 40px 100px rgba(0,0,0,.7), 0 2px 0 rgba(255,255,255,.05) inset;
  transition: opacity .4s ease, transform .4s ease;
  flex-shrink: 0;
}
#music-art.swapping {
  opacity: 0;
  transform: scale(.95);
}

/* Track info */
#music-track-info {
  text-align: center;
  width: 100%;
  max-width: 480px;
}
#music-title {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  margin-bottom: 6px;
}
#music-artist {
  font-size: 1rem;
  color: rgba(255,255,255,.7);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#music-album {
  font-size: .85rem;
  color: rgba(255,255,255,.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress */
#music-progress-wrap {
  width: 100%;
  max-width: 480px;
}
#music-progress-bar {
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  transition: height .15s ease;
}
#music-progress-bar:hover { height: 6px; }
#music-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width .5s linear;
  pointer-events: none;
}
#music-progress-times {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: rgba(255,255,255,.4);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Controls */
#music-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.music-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  line-height: 1;
  transition: color .15s ease, background .15s ease, transform .15s ease;
  font-family: inherit;
}
.music-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.music-btn:active { transform: scale(.88) !important; }
.music-btn--sm { font-size: 1.1rem; color: rgba(255,255,255,.5); }
.music-btn--sm:hover { color: rgba(255,255,255,.9); }
.music-btn--lg {
  font-size: 1.8rem;
  color: #fff;
  background: rgba(255,255,255,.15);
  padding: 14px;
}
.music-btn--lg:hover { background: rgba(255,255,255,.25); }
.music-btn--active { color: #1DB954 !important; }

/* Right panel — queue */
#music-queue-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,.4);
  border-left: 1px solid rgba(255,255,255,.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding-top: 80px;
  overflow: hidden;
}
#music-queue-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: 0 20px 12px;
  flex-shrink: 0;
}
#music-queue-list {
  overflow-y: auto;
  flex: 1;
  padding: 0 8px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
#music-queue-list::-webkit-scrollbar { width: 4px; }
#music-queue-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.1);
  border-radius: 999px;
}

/* Queue rows */
.music-queue-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background .15s ease;
}
.music-queue-row:hover { background: rgba(255,255,255,.07); }
.music-queue-row--current {
  background: rgba(255,255,255,.1);
  outline: 1px solid rgba(255,255,255,.12);
}
.music-queue-art {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.music-queue-info { flex: 1; min-width: 0; }
.music-queue-name {
  font-size: .83rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-queue-sub {
  font-size: .73rem;
  color: rgba(255,255,255,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.music-queue-dur {
  font-size: .72rem;
  color: rgba(255,255,255,.3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.music-queue-empty {
  font-size: .82rem;
  color: rgba(255,255,255,.3);
  padding: 16px 12px;
}

/* music mode button in header */
#music-mode-btn {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  font-family: inherit;
  display: none;
}
#music-mode-btn:hover {
  background: rgba(255,255,255,.2);
  transform: translateY(-2px);
}

/* Responsive — stack on small screens */
@media (max-width: 780px) {
  #music-overlay { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #music-queue-panel { border-left: none; border-top: 1px solid rgba(255,255,255,.07); padding-top: 16px; max-height: 35vh; }
  #music-now { padding: 40px 24px 24px; }
}


/* ============================================================
   REVAMP — high gear, same soul
   ============================================================ */

/* ----- Display font ----- */
.title {
  font-family: 'Syne', 'Poppins', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 4vw + 1rem, 4rem);
  letter-spacing: -.03em;
  line-height: 1.05;
}

/* ----- Grain texture overlay ----- */
#grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px;
  mix-blend-mode: overlay;
}

/* ----- Body upgrade ----- */
body {
  background: #050507;
}

/* ----- Background layers — more dramatic ----- */
.bg-layer {
  filter: blur(60px) brightness(0.55) saturate(1.4);
  transform: scale(1.25);
  transition: opacity 900ms cubic-bezier(.4,0,.2,1);
}

/* ----- Header ----- */
header[role="banner"] {
  margin-top: 72px;
  padding-bottom: 20px;
  background: none;
  border-bottom: none;
}

header[role="banner"] > div[style*="margin-top"] {
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.1);
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}

.subtle {
  font-size: clamp(.9rem, 1vw + .6rem, 1.05rem);
  color: rgba(255,255,255,.45);
  letter-spacing: .01em;
}

/* ----- Cards — deeper, more refined ----- */
.card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow:
    0 2px 0 rgba(255,255,255,.04) inset,
    0 24px 80px rgba(0,0,0,.5),
    0 1px 0 rgba(255,255,255,.06);
  border-radius: 20px;
  transition: transform .3s cubic-bezier(.22,.68,0,1.2), box-shadow .3s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 2px 0 rgba(255,255,255,.06) inset,
    0 32px 100px rgba(0,0,0,.6),
    0 1px 0 rgba(255,255,255,.08);
}
.card__header {
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding: 16px 20px;
}
.card__title {
  font-family: 'Syne', 'Poppins', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
}

/* ----- Sidebar ----- */
.sidebar {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.3);
}
.sidebar__search input {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: .85rem;
  color: #fff;
  padding: 9px 12px;
  letter-spacing: .01em;
}
.sidebar__search input::placeholder { color: rgba(255,255,255,.3); }
.sidebar__list li {
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: .01em;
  color: rgba(255,255,255,.8);
}
.sidebar__list li[aria-selected="true"] {
  background: rgba(255,255,255,.09);
  color: #fff;
  outline: 1px solid rgba(255,255,255,.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.sidebar__list li:hover { background: rgba(255,255,255,.05); }

/* ----- Buttons — header bar ----- */
#spotify-connect {
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: #000;
  box-shadow: 0 4px 20px rgba(255,204,0,.25);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
#spotify-connect:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255,204,0,.4);
  filter: brightness(1.08);
}
#spotify-connect:active { transform: scale(.96) !important; }

#ugs-doc, #ambient-toggle, #open-blank {
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  box-shadow: 0 4px 16px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
#ugs-doc:hover, #ambient-toggle:hover, #open-blank:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,.13);
  box-shadow: 0 8px 24px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.1);
}

#sp-panel-open {
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(29,185,84,.12);
  border: 1px solid rgba(29,185,84,.25);
  color: #1DB954;
  box-shadow: 0 4px 20px rgba(29,185,84,.1), inset 0 1px 0 rgba(29,185,84,.1);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
#sp-panel-open:hover {
  transform: translateY(-2px);
  background: rgba(29,185,84,.2);
  box-shadow: 0 8px 28px rgba(29,185,84,.25);
}

/* ----- Toast — full rebuild ----- */
#toast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 3;
  display: none;
  align-items: center;
  gap: 14px;
  background: rgba(14,14,18,.88);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow:
    0 12px 50px rgba(0,0,0,.6),
    0 1px 0 rgba(255,255,255,.07) inset,
    0 0 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  max-width: 340px;
  min-width: 260px;
}

#toast-img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

.toast-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

#toast-title {
  font-weight: 700;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  letter-spacing: .01em;
}

#toast-sub {
  font-size: .78rem;
  color: rgba(255,255,255,.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  letter-spacing: .01em;
}

#toast-controls {
  display: none;
  gap: 6px;
  flex-shrink: 0;
}

#toast-controls button {
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 6px 9px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.85);
  font-size: .85rem;
  transition: background .15s ease, transform .12s ease;
  line-height: 1;
}
#toast-controls button:hover { background: rgba(255,255,255,.14); }
#toast-controls button:active { transform: scale(.9); }

/* ----- Idle overlay — more cinematic ----- */
#idle-overlay .idle-center {
  border-radius: 28px;
  box-shadow:
    0 60px 160px rgba(0,0,0,.7),
    0 0 0 1px rgba(255,255,255,.06) inset;
}
#idle-overlay #idle-title {
  font-family: 'Syne', 'Poppins', sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 2.5vw + 8px, 32px);
  letter-spacing: -.02em;
}
#idle-overlay #idle-artist {
  color: rgba(255,255,255,.6);
  font-size: clamp(12px, 1.2vw + 6px, 15px);
  letter-spacing: .01em;
}

/* ----- Footer ----- */
footer {
  font-size: .82rem;
  letter-spacing: .02em;
  color: rgba(255,255,255,.25);
}

/* ----- Gold title upgrade ----- */
.title--gold {
  background: linear-gradient(100deg, #ffcc00 0%, #ffe566 40%, #ffd700 60%, #ffaa00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px rgba(255,204,0,.3));
  animation: goldShimmer 3s ease infinite;
}
@keyframes goldShimmer {
  0%,100% { filter: drop-shadow(0 0 16px rgba(255,204,0,.25)); }
  50%      { filter: drop-shadow(0 0 40px rgba(255,204,0,.55)); }
}

/* ----- Spotify panel upgrade ----- */
#sp-panel {
  background: rgba(10,10,14,.92);
  border-left: 1px solid rgba(255,255,255,.08);
  box-shadow: -20px 0 80px rgba(0,0,0,.7);
}
.sp-header {
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sp-header-title {
  font-family: 'Syne', 'Poppins', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .04em;
}
.sp-now-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.sp-progress-fill { background: #1DB954; }
.sp-section-label {
  font-family: 'Syne', 'Poppins', sans-serif;
  font-size: .65rem;
  letter-spacing: 1.6px;
}

/* ----- Rarity badge ----- */
.rarity {
  font-family: 'Syne', sans-serif;
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}


/* ============================================================
   MUSIC MODE — REVAMP
   ============================================================ */

/* Overlay — full bleed, album art blurred behind everything */
#music-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  grid-template-columns: 1fr min(300px, 28vw);
  grid-template-rows: 1fr;
  align-items: center;
  justify-items: center;
  gap: 0;
  padding: 0;
  background: #080810;
  opacity: 0;
  transition: opacity .4s ease;
  overflow: hidden;
}
#music-overlay.is-visible { opacity: 1; }

/* Album art blurred background */
#music-overlay::before {
  content: '';
  position: absolute;
  inset: -40px;
  background-image: var(--music-art-url, none);
  background-size: cover;
  background-position: center;
  filter: blur(80px) brightness(.35) saturate(1.6);
  transform: scale(1.15);
  z-index: 0;
  transition: background-image .6s ease;
}

/* Dark vignette over the bg */
#music-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, transparent 30%, rgba(0,0,0,.55) 100%),
    linear-gradient(to right, rgba(0,0,0,.2), rgba(0,0,0,.5));
  z-index: 0;
  pointer-events: none;
}

/* Everything inside sits above the bg */
#music-now,
#music-queue-panel,
#music-exit {
  position: relative;
  z-index: 1;
}

/* Exit button */
#music-exit {
  position: absolute;
  top: 24px;
  right: 28px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
  border-radius: 10px;
  padding: 8px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
  z-index: 2;
}
#music-exit:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
  transform: translateY(-1px);
}

/* Now playing panel */
#music-now {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: min(420px, 44vw);
  padding: 60px 40px;
}

/* Album art — with vinyl spin when playing */
#music-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 24px;
  object-fit: cover;
  box-shadow:
    0 60px 160px rgba(0,0,0,.8),
    0 0 0 1px rgba(255,255,255,.08),
    0 0 80px rgba(0,0,0,.4);
  transition: opacity .3s ease, transform .5s cubic-bezier(.22,.68,0,1.2), border-radius .4s ease;
  background: rgba(255,255,255,.05);
}
#music-art.swapping { opacity: 0; transform: scale(.96); }

/* Track info */
#music-track-info {
  text-align: center;
  width: 100%;
}
#music-title {
  font-family: 'Syne', 'Poppins', sans-serif;
  font-weight: 800;
  font-size: clamp(1.2rem, 1.8vw + .5rem, 1.8rem);
  letter-spacing: -.02em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}
#music-artist {
  font-size: .95rem;
  font-weight: 500;
  color: rgba(255,255,255,.65);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .01em;
}
#music-album {
  font-size: .78rem;
  color: rgba(255,255,255,.35);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .02em;
}

/* Progress bar */
#music-progress-wrap { width: 100%; }
#music-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  cursor: pointer;
  transition: height .15s ease;
  position: relative;
}
#music-progress-bar:hover { height: 7px; }
#music-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width .8s linear;
  position: relative;
}
#music-progress-fill::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
#music-progress-bar:hover #music-progress-fill::after { transform: translateY(-50%) scale(1); }

#music-progress-times {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: rgba(255,255,255,.35);
  margin-top: 8px;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

/* Controls */
#music-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.music-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s ease, transform .18s ease, color .18s ease, box-shadow .18s ease;
  flex-shrink: 0;
}
.music-btn:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
  transform: scale(1.1);
}
.music-btn:active { transform: scale(.92) !important; }
.music-btn--sm {
  width: 38px;
  height: 38px;
  font-size: .85rem;
  background: transparent;
  border-color: rgba(255,255,255,.08);
  color: rgba(255,255,255,.5);
}
.music-btn--sm:hover { color: rgba(255,255,255,.9); }
.music-btn--lg {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  background: #fff;
  color: #000;
  border: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.music-btn--lg:hover {
  background: rgba(255,255,255,.9);
  transform: scale(1.06);
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.music-btn--active {
  color: #1DB954 !important;
  border-color: rgba(29,185,84,.35) !important;
}

/* Queue panel */
#music-queue-panel {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(0,0,0,.35);
  border-left: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(12px);
  padding: 80px 0 24px;
  box-shadow: inset 1px 0 0 rgba(255,255,255,.04);
}
#music-queue-label {
  font-family: 'Syne', 'Poppins', sans-serif;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 0 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
#music-queue-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
  padding: 8px 0;
}
#music-queue-list::-webkit-scrollbar { width: 3px; }
#music-queue-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 999px; }

.music-queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  transition: background .15s ease;
  cursor: default;
}
.music-queue-row:hover { background: rgba(255,255,255,.06); }
.music-queue-row--current {
  background: rgba(255,255,255,.05);
  border-left: 2px solid #1DB954;
  padding-left: 18px;
}
.music-queue-art {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
}
.music-queue-info { flex: 1; min-width: 0; }
.music-queue-name {
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-queue-sub {
  font-size: .72rem;
  color: rgba(255,255,255,.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.music-queue-dur {
  font-size: .7rem;
  color: rgba(255,255,255,.3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.music-queue-empty {
  font-size: .82rem;
  color: rgba(255,255,255,.25);
  padding: 16px 20px;
}

/* Music mode button (in header) */
#music-mode-btn {
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
#music-mode-btn:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,.13);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

/* Responsive */
@media (max-width: 800px) {
  #music-overlay {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    align-items: start;
    overflow-y: auto;
    padding-top: 60px;
  }
  #music-now {
    width: min(320px, 85vw);
    padding: 20px 20px 0;
    gap: 20px;
  }
  #music-queue-panel {
    width: 100%;
    height: auto;
    min-height: 200px;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 16px 0 40px;
  }
}

/* ============================================================
   LIQUID GLASS POLISH — same interface, more considered materials
   ============================================================ */
:root {
  --glass-surface: rgba(24, 25, 32, .72);
  --glass-surface-raised: rgba(35, 36, 44, .78);
  --glass-edge: rgba(255, 255, 255, .12);
  --glass-highlight: rgba(255, 255, 255, .08);
  --glass-shadow: 0 18px 48px rgba(0, 0, 0, .34), 0 1px 0 rgba(255, 255, 255, .06) inset;
  --control-radius: 12px;
}

/* Keep the original slow gradient alive beneath album-art backgrounds. */
body {
  background: linear-gradient(135deg, #050507 0%, #101018 48%, #080b10 100%);
  background-size: 300% 300%;
}

/* Compact toolbar hierarchy; the buttons remain the existing controls. */
header[role="banner"] {
  width: min(100% - 32px, 1180px);
  margin-top: clamp(28px, 6vh, 64px);
  padding: 20px 22px 18px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.025));
  box-shadow: 0 16px 44px rgba(0,0,0,.2), 0 1px 0 rgba(255,255,255,.08) inset;
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
}
header[role="banner"] > div[style*="margin-top"] {
  max-width: 100%;
  flex-wrap: wrap;
  margin-top: 18px !important;
  padding: 7px;
  gap: 7px;
  border-color: rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(8,9,13,.44);
  box-shadow: 0 8px 24px rgba(0,0,0,.16), 0 1px 0 rgba(255,255,255,.06) inset;
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
}
.title {
  text-shadow: 0 2px 28px rgba(0,0,0,.28);
}
.subtle { margin-top: 8px; }

/* The gold state used to replace titleSwoop with a filter-only shimmer.
   Since the base title starts transparent and translated, it stayed hidden.
   Run the entrance and shimmer together; they animate separate properties. */
.title--gold {
  animation: titleSwoop 1.5s ease-out .3s both, goldShimmer 3s ease-in-out 1.8s infinite;
  text-shadow: none;
}

/* Floating browser shell with a separate, content-first player surface. */
main[role="main"] { margin-top: clamp(22px, 4vh, 38px); }
.card {
  width: min(calc(100% - 32px), 1760px);
  overflow: hidden;
  border-color: rgba(255,255,255,.1);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}
.card:hover { transform: none; }
.card__header { padding: 15px 20px; }
.card__body { padding: 14px; }
.player-layout {
  grid-template-columns: clamp(250px, 22vw, 350px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
.sidebar {
  max-height: clamp(340px, 70vh, 820px);
  border-color: rgba(255,255,255,.11);
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(37,38,46,.82), rgba(20,21,27,.76));
  box-shadow: 0 12px 32px rgba(0,0,0,.24), 0 1px 0 rgba(255,255,255,.07) inset;
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
}
.sidebar__search { padding: 12px; }
.sidebar__search input {
  min-height: 40px;
  border-color: rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(0,0,0,.22);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.sidebar__search input:focus {
  outline: none;
  border-color: rgba(184,196,255,.48);
  background: rgba(0,0,0,.32);
  box-shadow: 0 0 0 3px rgba(143,160,255,.12);
}
.sidebar__list { padding: 6px 8px 10px; }
.sidebar__list li {
  min-height: 42px;
  margin: 2px 0;
  padding: 7px 9px 7px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.sidebar__list li:hover {
  background: rgba(255,255,255,.075);
  border-color: rgba(255,255,255,.055);
}
.sidebar__list li[aria-selected="true"] {
  background: linear-gradient(110deg, rgba(255,255,255,.14), rgba(255,255,255,.075));
  border-color: rgba(255,255,255,.13);
  outline: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 4px 12px rgba(0,0,0,.12);
}
.sidebar-game-name { line-height: 1.35; }
.fav-btn {
  width: 32px;
  height: 30px;
  border-radius: 9px;
  color: rgba(255,255,255,.55);
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.fav-btn:hover, .fav-btn--on {
  color: #ffdc75;
  background: rgba(255,210,91,.1);
}

#game-frame {
  min-width: 0;
  padding: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.025));
  box-shadow: 0 16px 38px rgba(0,0,0,.3), 0 1px 0 rgba(255,255,255,.09) inset;
}
#game-iframe {
  height: clamp(380px, 70vh, 920px);
  border-radius: 14px;
  background: #08090d;
}

/* One tactile control language for the existing header and overlays. */
#spotify-connect, #ugs-doc, #ambient-toggle, #sp-panel-open,
#sp-panel-close, #toast-controls button, #music-exit, .music-btn,
.sp-play-btn, .sp-reauth-btn {
  border-radius: var(--control-radius);
  transition: transform .16s ease, background .16s ease, border-color .16s ease,
    box-shadow .16s ease, color .16s ease, filter .16s ease;
}
#spotify-connect {
  background: linear-gradient(145deg, #ffdf78, #edbd45);
  box-shadow: 0 4px 12px rgba(210,160,45,.16), 0 1px 0 rgba(255,255,255,.4) inset;
}
#spotify-connect:hover { box-shadow: 0 7px 18px rgba(210,160,45,.22), 0 1px 0 rgba(255,255,255,.48) inset; }
#spotify-connect:disabled { cursor: default; filter: saturate(.68); }
#ugs-doc, #ambient-toggle {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.13);
  box-shadow: 0 1px 0 rgba(255,255,255,.07) inset;
}
#sp-panel-open {
  background: rgba(29,185,84,.12);
  border-color: rgba(29,185,84,.22);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset;
}
button:focus-visible, input:focus-visible, #music-progress-bar:focus-visible {
  outline: 2px solid rgba(190,202,255,.9);
  outline-offset: 3px;
}

/* Music controls and side panel share the browser's restrained glass material. */
#sp-panel {
  width: min(420px, 94vw);
  background: rgba(20,21,27,.88);
  border-left-color: rgba(255,255,255,.12);
  box-shadow: -16px 0 46px rgba(0,0,0,.38), 1px 0 0 rgba(255,255,255,.05) inset;
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
}
#sp-panel-backdrop { background: rgba(0,0,0,.38); }
.sp-header { padding: 20px 22px 16px; }
.sp-section { padding-left: 22px; padding-right: 22px; }
.sp-now-card { border-radius: 16px; background: rgba(255,255,255,.065); }
.sp-track-row { min-height: 56px; }
.sp-play-btn { opacity: 1; }
#music-overlay {
  background: #090a10;
  background-image: linear-gradient(135deg, rgba(18,20,29,.7), rgba(5,6,10,.82));
}
#music-overlay::before {
  filter: blur(52px) brightness(.4) saturate(1.25);
}
#music-overlay::after {
  background: linear-gradient(90deg, rgba(0,0,0,.12), rgba(0,0,0,.48));
}
#music-now { width: min(460px, 48vw); }
#music-art {
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(0,0,0,.42), 0 1px 0 rgba(255,255,255,.16) inset;
}
#music-queue-panel {
  background: rgba(18,19,25,.42);
  border-left-color: rgba(255,255,255,.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
}
#music-progress-bar { height: 5px; border-radius: 99px; cursor: pointer; }
#music-progress-fill { border-radius: inherit; }
.music-btn { border: 1px solid rgba(255,255,255,.1); }
.music-btn--lg { box-shadow: 0 4px 16px rgba(0,0,0,.18); }

/* A quiet glass caption keeps the screensaver artwork in front. */
#idle-overlay .idle-center {
  width: min(52vh, 500px);
  height: min(52vh, 500px);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 26px;
  box-shadow: 0 32px 90px rgba(0,0,0,.48), 0 1px 0 rgba(255,255,255,.18) inset;
}
#idle-overlay .idle-meta {
  left: clamp(18px, 4vw, 52px);
  bottom: clamp(18px, 4vh, 46px);
  max-width: min(72vw, 720px);
  padding: 16px 20px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(18,19,25,.48);
  box-shadow: 0 12px 32px rgba(0,0,0,.2), 0 1px 0 rgba(255,255,255,.08) inset;
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
}

/* Keep the intentional full-screen Easter egg cinematic and unobstructed. */
#mcqueen-video-wrap { background: #050507; }
#mcqueen-video { border: 1px solid rgba(255,255,255,.12); }

@media (max-width: 980px) {
  header[role="banner"] { padding: 18px 14px 16px; border-radius: 20px; }
  .player-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sidebar { max-height: 36vh; min-height: 180px; }
  #game-frame { padding: 5px; border-radius: 16px; }
  #game-iframe { height: 60vh; min-height: 320px; border-radius: 12px; }
}
@media (max-width: 600px) {
  header[role="banner"] { width: calc(100% - 20px); margin-top: 14px; padding: 16px 10px 13px; }
  .title { font-size: clamp(2rem, 10vw, 3rem); }
  header[role="banner"] > div[style*="margin-top"] { width: 100%; justify-content: center; }
  header[role="banner"] > div[style*="margin-top"] button { padding: 8px 10px; font-size: .76rem; }
  .card { width: calc(100% - 20px); border-radius: 18px; }
  .card__body { padding: 9px; }
  .sidebar { max-height: 34vh; }
  #game-iframe { height: 58vh; min-height: 280px; }
  #toast { left: 10px; right: 10px; bottom: 10px; min-width: 0; max-width: none; gap: 10px; padding: 10px; }
  #toast-img { width: 44px; height: 44px; }
  #idle-overlay .idle-center { width: min(66vw, 40vh); height: min(66vw, 40vh); }
  #idle-overlay .idle-meta { right: 14px; max-width: none; }
  #sp-panel { width: min(420px, 100vw); }
}
@media (max-width: 800px) {
  #music-overlay { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(220px, 1fr); }
  #music-now { width: min(340px, 86vw); padding: 18px 16px 16px; gap: 18px; }
  #music-art { width: min(100%, 38vh); }
  #music-queue-panel { min-height: 220px; max-height: 42vh; overflow-y: auto; border-top: 1px solid rgba(255,255,255,.1); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Local game portal: the player now uses the full content width. */
.player-layout {
  display: block;
  width: 100%;
}
#game-frame {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-height: min(78vh, 960px);
  padding: clamp(8px, 1.2vw, 14px);
  border-radius: 24px;
}
.game-empty-state {
  flex: 1;
  min-height: clamp(390px, 66vh, 780px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 6vw, 72px) 22px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.085);
  border-radius: 17px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255,255,255,.045), transparent 48%),
    rgba(5,6,10,.35);
}
.game-empty-icon {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  margin-bottom: 23px;
  padding-left: 3px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 19px;
  background: linear-gradient(145deg, rgba(255,255,255,.15), rgba(255,255,255,.055));
  color: rgba(255,255,255,.88);
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 12px 30px rgba(0,0,0,.18);
}
.game-empty-state h3 {
  margin: 0;
  color: rgba(255,255,255,.94);
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  font-weight: 650;
  letter-spacing: -.035em;
}
.game-empty-state > p {
  max-width: 430px;
  margin: 12px 0 24px;
  color: rgba(235,237,245,.67);
  line-height: 1.65;
}
.load-game-btn {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.19), rgba(255,255,255,.09));
  color: #fff;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,.16) inset, 0 7px 20px rgba(0,0,0,.18);
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.load-game-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.3);
  background: linear-gradient(145deg, rgba(255,255,255,.25), rgba(255,255,255,.12));
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 10px 24px rgba(0,0,0,.22);
}
.load-game-btn:active { transform: translateY(1px) scale(.985); }
.game-player-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px 1px;
}
.game-file-meta { min-width: 0; display: flex; align-items: baseline; gap: 9px; }
.game-file-label {
  flex: 0 0 auto;
  color: rgba(235,237,245,.48);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.game-file-name {
  min-width: 0;
  overflow: hidden;
  color: rgba(255,255,255,.85);
  font-size: .88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.load-game-btn--compact { min-height: 36px; padding: 0 13px; border-radius: 12px; font-size: .85rem; }
.game-load-error { margin: 0; color: #ffb7b7; font-size: .86rem; }
#game-iframe {
  flex: 1 1 auto;
  width: 100%;
  min-height: clamp(390px, 70vh, 900px);
  height: auto;
  border-radius: 17px;
  background: #08090d;
}
#game-iframe[hidden], #game-player-toolbar[hidden], #game-empty-state[hidden], #game-load-error[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  #game-frame { min-height: 70vh; }
  .game-empty-state { min-height: 60vh; }
  #game-iframe { min-height: 60vh; }
}
@media (max-width: 600px) {
  #game-frame { min-height: 66vh; padding: 6px; border-radius: 18px; }
  .game-empty-state { min-height: 58vh; padding: 28px 18px; border-radius: 13px; }
  .game-empty-icon { width: 52px; height: 52px; border-radius: 16px; }
  .game-player-toolbar { align-items: flex-start; }
  .game-file-meta { flex-direction: column; gap: 3px; }
  .game-file-name { max-width: 48vw; }
  .load-game-btn--compact { flex: 0 0 auto; padding: 0 10px; font-size: .76rem; }
  #game-iframe { min-height: 58vh; border-radius: 13px; }
}

