/* ================================================================
   MUSICOZY STYLESHEET
   Sections follow the visual order of the page so each component is
   easy to find and edit. Responsive overrides are grouped at the end.
   ================================================================ */

/* ======================== DESIGN TOKENS ======================== */
:root{
  --bg: #000000;
  --panel-bg: #121212;
  --surface: #151318;
  --surface-raised: #1e1b21;
  --surface-hover: #262229;
  --border: #2a262d;

  --text: #f3efe9;
  --text-muted: #948d8c;
  --text-faint: #625d5f;

  --amber: #e3a94d;
  --amber-bright: #f4c377;
  --amber-dim: #6b5330;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --panel-gap: 5px;
  --premium-button-width: 136px;
  --premium-quarter: 34px;
  --nav-control-gap: 18px;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ======================== BASE STYLES ======================== */
*{ box-sizing: border-box; margin:0; padding:0; }

.material-symbols-rounded{
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: inherit;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
/* Filled Material Symbol state used by active Like/Favorite buttons. */
.like-btn.is-liked .material-symbols-rounded,
.panel-like-btn.is-liked .material-symbols-rounded,
.round-btn.ghost.is-liked .material-symbols-rounded{
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

html, body{
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a{ color:inherit; text-decoration:none; }
button{ font-family: inherit; border:none; background:none; color:inherit; cursor:pointer; }
img{ display:block; max-width:100%; }

::selection{ background: var(--amber-dim); color: var(--text); }

/* Shared keyboard focus indicator. */
button:focus-visible, a:focus-visible{
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ======================== TOOLTIPS ======================== */
.has-tooltip{ position: relative; }

.cursor-tooltip{
  position: fixed;
  left: -9999px;
  top: -9999px;
  background: #ffffff;
  color: #141118;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
  pointer-events: none;
  opacity: 0;
  z-index: 9999;
  transition: opacity .1s ease;
}
.cursor-tooltip.is-visible{ opacity: 1; }
.cursor-tooltip.is-dark{
  background: #141118;
  color: #ffffff;
  transform: translateX(-50%);
}
.cursor-tooltip.is-top{
  transform: translate(-50%, -100%);
}

/* ======================== APPLICATION LAYOUT ======================== */
.app{
  display:grid;
  grid-template-columns: 330px minmax(0, 1fr) 320px;
  grid-template-rows: 76px minmax(0, 1fr);
  column-gap: var(--panel-gap);
  height: calc(100vh - 90px);
  min-height: 0;
  padding-right: 6px;
}

/* ======================== SIDEBAR ======================== */
.sidebar{
  grid-column: 1;
  grid-row: 1 / 3;
  background: var(--bg);
  padding: 10px 0 6px 20px;
  display:flex;
  flex-direction:column;
  width: auto;
  height: 100%;
  min-height: 0;
}

.brand{
  display:flex;
  align-items:center;
  min-height: 52px;
  margin-bottom: 14px;
}
.brand-logo-img{
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  display:block;
  background: #ffffff;
  padding: 4px;
}

.sidebar-box{
  flex: 1;
  min-height: 0;
  display:flex;
  flex-direction:column;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

/* Keep the sidebar shell fixed while only its playlist list scrolls. */
.sidebar .playlists{
  flex:1;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-gutter:stable;
  scrollbar-width:auto;
  scrollbar-color:transparent transparent;
  overscroll-behavior:contain;
}

.nav{
  display:flex;
  flex-direction:column;
  gap: 4px;
  margin-bottom: 20px;
}
.nav-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .15s ease, background .15s ease;
}
.nav-item:hover{ color: var(--text); background: var(--surface); }
.nav-item.active{ color: var(--text); }
.nav-icon{
  width: 20px;
  text-align:center;
  color: var(--amber);
  font-size: 19px;
}

.playlists-label{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  margin-bottom: 12px;
  font-weight: 600;
}
.create-playlist-btn{
  width:100%;
  display:flex;
  align-items:center;
  gap:9px;
  margin-bottom:6px;
  padding:8px 10px;
  border-radius:var(--radius-sm);
  color:var(--text);
  font-size:13.5px;
  font-weight:600;
  text-align:left;
  transition:color .15s ease, background .15s ease;
}
.create-playlist-btn:hover{ background:var(--surface); }
.create-playlist-btn .material-symbols-rounded{
  color:var(--amber);
  font-size:19px;
}
.playlist-item{
  display:block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-muted);
  transition: color .15s ease, background .15s ease;
}
.playlist-item:hover{ color: var(--text); background: var(--surface); }
.playlist-item.active{
  color: var(--text);
  background: var(--surface-raised);
  font-weight: 600;
  box-shadow: inset 3px 0 var(--amber);
}
.playlist-item.liked-songs-item,
.playlist-item.recently-played-item{
  display:flex;
  align-items:center;
  gap:9px;
  color: var(--text);
}
.liked-songs-item .material-symbols-rounded,
.recently-played-item .material-symbols-rounded{
  color: var(--amber);
  font-size:18px;
}
.liked-songs-item .material-symbols-rounded{
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.playlist-divider{
  height:1px;
  margin:8px 10px;
  background: var(--border);
}
.custom-playlist-list{
  margin-top:6px;
  padding-top:6px;
  border-top:1px solid var(--border);
}
.custom-playlist-item{
  display:flex;
  align-items:center;
  gap:8px;
}
.custom-playlist-cover{
  width:24px;
  height:24px;
  flex-shrink:0;
  border-radius:4px;
  object-fit:cover;
  background:var(--surface-raised);
}
.custom-playlist-item .material-symbols-rounded{
  flex-shrink:0;
  color:var(--amber);
  font-size:16px;
}
.custom-playlist-name{
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.playlist-item.is-favorite{
  display:flex;
  align-items:center;
  gap:8px;
}
.playlist-item.is-favorite::after{
  content:"favorite";
  flex-shrink:0;
  margin-left:auto;
  color:var(--amber);
  font-family:'Material Symbols Rounded';
  font-size:17px;
  line-height:1;
  font-variation-settings:'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ======================== CREATE/RENAME PLAYLIST DIALOG ======================== */
.playlist-modal{
  position:fixed;
  inset:0;
  z-index:1000;
  display:grid;
  place-items:center;
  padding:20px;
}
.playlist-modal[hidden]{ display:none; }
.playlist-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(5px);
}
.playlist-dialog{
  position:relative;
  width:min(420px, 100%);
  padding:24px;
  background:var(--panel-bg);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  box-shadow:0 28px 80px rgba(0,0,0,.58);
}
.playlist-dialog-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
}
.playlist-dialog-kicker{
  margin-bottom:5px;
  color:var(--amber);
  font-size:10px;
  font-weight:700;
  letter-spacing:1px;
  text-transform:uppercase;
}
.playlist-dialog h2{
  font-family:var(--font-display);
  font-size:25px;
}
.playlist-dialog-close{
  width:34px;
  height:34px;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  color:var(--text-muted);
  font-size:20px;
  transition:color .15s ease, background .15s ease;
}
.playlist-dialog-close:hover{
  color:var(--text);
  background:var(--surface-hover);
}
.playlist-dialog-copy{
  margin-top:12px;
  color:var(--text-muted);
  font-size:13px;
  line-height:1.5;
}
.playlist-form{
  margin-top:20px;
}
.playlist-form label{
  display:block;
  margin-bottom:7px;
  color:var(--text-muted);
  font-size:12px;
  font-weight:600;
}
.playlist-form input{
  width:100%;
  height:46px;
  padding:0 13px;
  background:var(--surface-raised);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  outline:none;
  color:var(--text);
  font-family:var(--font-body);
  font-size:14px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.playlist-form input:focus{
  border-color:var(--amber);
  box-shadow:0 0 0 3px rgba(227,169,77,.13);
}
.playlist-name-error{
  min-height:18px;
  margin-top:6px;
  color:#e36b6b;
  font-size:11.5px;
}
.playlist-dialog-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:12px;
}
.dialog-btn{
  padding:9px 17px;
  border-radius:999px;
  font-size:13px;
  font-weight:700;
  transition:background .15s ease, color .15s ease, transform .1s ease;
}
.dialog-btn:active{ transform:scale(.96); }
.dialog-btn-secondary{
  color:var(--text-muted);
  border:1px solid var(--border);
}
.dialog-btn-secondary:hover{
  color:var(--text);
  background:var(--surface-hover);
}
.dialog-btn-primary{
  color:#141118;
  background:var(--amber);
}
.dialog-btn-primary:hover{ background:var(--amber-bright); }
.dialog-btn:disabled{
  cursor:not-allowed;
  opacity:.45;
}
.dialog-btn-primary:disabled:hover{ background:var(--amber); }

/* ======================== PLAYLIST COVER EDITOR ======================== */
.playlist-cover-dialog{ width:min(480px, 100%); }
.cover-choose-btn{
  width:100%;
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  margin-top:18px;
  padding:10px 16px;
  color:var(--text);
  background:var(--surface-raised);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  font-size:13px;
  font-weight:700;
  transition:background .15s ease, border-color .15s ease;
}
.cover-choose-btn:hover{
  background:var(--surface-hover);
  border-color:var(--amber-dim);
}
.cover-choose-btn .material-symbols-rounded{
  color:var(--amber);
  font-size:20px;
}
.playlist-cover-editor{
  margin-top:16px;
}
.playlist-cover-editor[hidden]{ display:none; }
.playlist-cover-canvas-wrap{
  width:min(300px, 100%);
  aspect-ratio:1;
  margin-inline:auto;
  overflow:hidden;
  background:#090909;
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  box-shadow:0 16px 34px rgba(0,0,0,.38);
}
#playlist-cover-canvas{
  width:100%;
  height:100%;
  display:block;
  cursor:grab;
  touch-action:none;
  outline:none;
}
#playlist-cover-canvas.is-dragging{ cursor:grabbing; }
#playlist-cover-canvas:focus-visible{
  box-shadow:inset 0 0 0 3px var(--amber);
}
.cover-zoom-control{
  display:grid;
  grid-template-columns:auto minmax(0, 1fr);
  align-items:center;
  gap:12px;
  margin-top:16px;
  color:var(--text-muted);
  font-size:12px;
  font-weight:700;
}
.cover-zoom-control input{
  width:100%;
  accent-color:var(--amber);
  cursor:pointer;
}
.cover-editor-help{
  margin-top:8px;
  color:var(--text-faint);
  font-size:11.5px;
  line-height:1.45;
  text-align:center;
}
.playlist-cover-error{
  min-height:18px;
  margin-top:8px;
  color:#e36b6b;
  font-size:11.5px;
}

/* ======================== ADD-TO-PLAYLIST DIALOG ======================== */
.add-to-playlist-dialog{
  max-height:min(620px, 86vh);
  display:flex;
  flex-direction:column;
}
.destination-track-name{
  margin-top:14px;
  color:var(--text);
  font-size:14px;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.playlist-destination-list{
  display:flex;
  flex-direction:column;
  gap:7px;
  margin-top:14px;
  padding-right:3px;
  overflow-y:auto;
}
.playlist-destination-option{
  width:100%;
  display:flex;
  align-items:center;
  gap:11px;
  padding:10px 11px;
  background:var(--surface-raised);
  border:1px solid transparent;
  border-radius:var(--radius-md);
  color:var(--text);
  text-align:left;
  transition:background .15s ease, border-color .15s ease;
}
.playlist-destination-option:hover{ background:var(--surface-hover); }
.playlist-destination-option.is-selected{ border-color:var(--amber-dim); }
.destination-playlist-icon{
  color:var(--amber);
  font-size:20px;
  flex-shrink:0;
}
.destination-playlist-copy{
  flex:1;
  min-width:0;
}
.destination-playlist-name{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:13px;
  font-weight:600;
}
.destination-playlist-type{
  display:block;
  margin-top:2px;
  color:var(--text-muted);
  font-size:11px;
}
.destination-check{
  flex-shrink:0;
  color:var(--text-faint);
  font-size:21px;
}
.playlist-destination-option.is-selected .destination-check{ color:var(--amber); }
.destination-empty-state{
  padding:12px;
  color:var(--text-muted);
  font-size:12px;
  line-height:1.5;
  text-align:center;
}

/* ======================== PLAYLIST CONFIRMATION TOAST ======================== */
.playlist-toast{
  position:fixed;
  left:50%;
  bottom:108px;
  z-index:1100;
  display:flex;
  align-items:center;
  gap:9px;
  max-width:calc(100vw - 30px);
  padding:11px 14px;
  background:#f3efe9;
  border-radius:999px;
  color:#141118;
  box-shadow:0 16px 42px rgba(0,0,0,.48);
  transform:translateX(-50%);
  font-size:13px;
  font-weight:600;
}
.playlist-toast[hidden]{ display:none; }
.playlist-toast-heart{
  color:var(--amber);
  font-size:19px;
  font-variation-settings:'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}
.playlist-toast-message{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.playlist-toast-change{
  flex-shrink:0;
  padding-left:9px;
  border-left:1px solid rgba(20,17,24,.22);
  color:#7a541a;
  font-size:12px;
  font-weight:800;
}
.playlist-toast-change:hover{ text-decoration:underline; }

/* ======================== NAVBAR NOTICE ======================== */
.demo-feature-toast{
  position:fixed;
  top:84px;
  right:20px;
  z-index:1200;
  width:min(390px, calc(100vw - 28px));
  display:grid;
  grid-template-columns:auto minmax(0, 1fr) auto;
  align-items:start;
  gap:11px;
  padding:13px 12px 13px 14px;
  color:var(--text);
  background:#211e23;
  border:1px solid var(--border);
  border-left:3px solid var(--amber);
  border-radius:var(--radius-md);
  box-shadow:0 18px 46px rgba(0,0,0,.58);
  animation:demo-feature-toast-in .2s ease-out;
}
.demo-feature-toast[hidden]{ display:none; }
.demo-feature-icon{
  margin-top:1px;
  color:var(--amber);
  font-size:22px;
  font-variation-settings:'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.demo-feature-copy{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.demo-feature-copy strong{
  font-size:13px;
  font-weight:700;
}
.demo-feature-copy > span{
  color:var(--text-muted);
  font-size:12px;
  line-height:1.45;
}
.demo-feature-close{
  width:30px;
  height:30px;
  display:flex;
  align-items:center;
  justify-content:center;
  margin-top:-4px;
  margin-right:-3px;
  border-radius:50%;
  color:var(--text-muted);
  transition:color .15s ease, background .15s ease, transform .1s ease;
}
.demo-feature-close .material-symbols-rounded{ font-size:19px; }
.demo-feature-close:hover{
  color:var(--text);
  background:rgba(255,255,255,.08);
}
.demo-feature-close:active{ transform:scale(.9); }
.demo-feature-close:focus-visible{
  outline:2px solid var(--amber);
  outline-offset:2px;
}

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

/* ======================== PLAYBACK STATUS MESSAGE ======================== */
.playback-status{
  position:fixed;
  left:50%;
  bottom:102px;
  z-index:1050;
  display:flex;
  align-items:center;
  gap:9px;
  width:fit-content;
  max-width:calc(100vw - 30px);
  padding:11px 12px 11px 14px;
  background:#211e23;
  border:1px solid var(--amber-dim);
  border-radius:18px;
  color:var(--text);
  box-shadow:0 16px 42px rgba(0,0,0,.55);
  transform:translateX(-50%);
  font-size:12.5px;
  font-weight:600;
}
.playback-status[hidden]{ display:none; }
.playback-status-icon{
  flex-shrink:0;
  color:var(--amber);
  font-size:20px;
}
.playback-status.is-terminal{
  border-color:rgba(227,107,107,.55);
}
.playback-status.is-terminal .playback-status-icon{ color:#e36b6b; }
.playback-status-message{
  flex:0 1 auto;
  min-width:0;
  line-height:1.4;
}
.playback-status-close{
  width:30px;
  height:30px;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  color:var(--text-muted);
  font-size:18px;
}
.playback-status-close:hover{
  color:var(--text);
  background:var(--surface-hover);
}

/* ======================== MAIN CONTENT SHELL ======================== */
.main{
  grid-column: 2;
  grid-row: 2;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 0 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-content{
  flex: 1;
  min-width:0;
  min-height: 0;
  display:flex;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow:hidden;
}

.main-content-scroll{
  flex:1;
  min-width:0;
  min-height:0;
  padding:32px 40px 40px;
  overflow-y: auto;
  overflow-x:hidden;
  scrollbar-gutter: stable;
  scrollbar-width:auto;
  scrollbar-color:transparent transparent;
  overscroll-behavior:contain;
}

.main-header{
  grid-column: 2 / 4;
  grid-row: 1;
  display:grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items:center;
  column-gap: var(--panel-gap);
  height: 76px;
  min-width: 0;
  padding: 10px 0 14px;
}

/* ======================== NOW PLAYING PANEL ======================== */
.now-playing-panel{
  grid-column: 3;
  grid-row: 2;
  position: static;
  width: auto;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 0 6px;
}

.now-playing-box{
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  box-shadow: none;
}

.now-playing-heading,
.now-playing-details,
.up-next-heading,
.up-next-track{
  display: flex;
  align-items: center;
}

.now-playing-heading,
.now-playing-details,
.up-next-heading{
  justify-content: space-between;
}

.now-playing-kicker,
.panel-section-label{
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.now-playing-heading h2{
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 17px;
}

.now-playing-cover{
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 38px rgba(0,0,0,.35);
}

.now-playing-cover img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.now-playing-text{
  min-width: 0;
}

.now-playing-title{
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-artist{
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.panel-like-btn{
  margin-left: 12px;
  flex-shrink: 0;
}
.panel-like-btn.is-liked{ color: var(--amber); }

.artist-card{
  padding: 14px;
  background: var(--surface-raised);
  border-radius: var(--radius-md);
}

.artist-card-name{
  margin: 10px 0 5px;
  font-size: 14px;
  font-weight: 700;
}

.artist-card-copy{
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.up-next{
  margin-top: auto;
  padding-top: 2px;
}

.up-next-heading span{
  font-size: 11px;
  color: var(--amber);
}
.queue-list{
  display:flex;
  flex-direction:column;
  gap:7px;
  margin-top:10px;
}

.up-next-track{
  width:100%;
  gap: 11px;
  margin-top:0;
  padding: 9px;
  background: var(--surface-raised);
  border-radius: var(--radius-md);
  text-align:left;
  transition: background .15s ease, transform .1s ease;
}
.up-next-track:hover{ background:var(--surface-hover); }
.up-next-track:active{ transform:scale(.98); }

.up-next-track img{
  width: 42px;
  height: 42px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink:0;
}

.queue-track-number{
  width:14px;
  flex-shrink:0;
  font-family:var(--font-mono);
  font-size:10px;
  color:var(--text-faint);
  text-align:center;
}
.queue-track-copy{
  flex:1;
  min-width:0;
}
.queue-track-title{
  display:block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-track-artist{
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.queue-play-icon{
  flex-shrink:0;
  color:var(--amber);
  font-size:18px;
  opacity:0;
  transform:translateX(-3px);
  transition:opacity .15s ease, transform .15s ease;
}
.up-next-track:hover .queue-play-icon,
.up-next-track:focus-visible .queue-play-icon{
  opacity:1;
  transform:translateX(0);
}
.queue-empty-state{
  padding:14px 10px;
  border:1px dashed var(--border);
  border-radius:var(--radius-md);
  color:var(--text-muted);
  font-size:12px;
  line-height:1.45;
  text-align:center;
}

/* ======================== TOP NAVBAR ======================== */
.main-nav-zone{
  grid-column: 1;
  display:grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items:center;
  gap: 14px;
  min-width: 0;
}

.main-nav-center{
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(100%, 536px);
  min-width: 0;
}

.main-nav-zone .premium-btn{
  justify-self: end;
  position: relative;
  z-index: 20;
  width: var(--premium-button-width);
  left: calc(var(--panel-gap) + var(--premium-quarter));
  margin-left: 0;
  margin-right: 20px;
}

.search-bar{
  display:flex;
  align-items:center;
  gap: 10px;
  height: 50px;
  width: auto;
  max-width: 470px;
  flex: 1;
  padding: 0 16px;
  background: var(--surface-raised);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: border-color .15s ease, background .15s ease;
}
.search-bar:hover{ background: var(--surface-hover); }
.search-bar:focus-within{
  border-color: #ffffff;
  background: var(--surface-hover);
}
.search-icon{
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-bar:focus-within .search-icon{ color: var(--text); }

/* keep every icon inside the search bar the same size */
.search-bar .material-symbols-rounded{
  font-size: 30px;
}

.search-divider{
  color: #ffffff;
  opacity: 0.5;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

.browse-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color .15s ease, transform .1s ease;
}
.browse-btn:hover{ color: var(--text); }
.browse-btn:active{ transform: scale(0.9); }
.search-input{
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
}
.search-input::placeholder{ color: var(--text-faint); }
.search-clear-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  color: var(--text-muted);
  font-size: 22px;
  padding: 2px;
  border-radius: 50%;
  transition: color .15s ease, background .15s ease, transform .1s ease;
}
.search-clear-btn:hover{
  color: var(--text);
  background: rgba(255,255,255,.08);
}
.search-clear-btn:active{ transform: scale(.9); }
.search-clear-btn[hidden]{ display:none; }

.now-playing-nav-zone{
  grid-column: 2;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 0;
  padding-left: calc(var(--premium-quarter) + var(--nav-control-gap));
  width: 100%;
  white-space: nowrap;
}
.now-playing-nav-zone > *{ flex-shrink: 0; }

.premium-btn{
  font-size: 13px;
  font-weight: 700;
  color: #141118;
  background: #ffffff;
  border: 1px solid #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  transition: background .15s ease, transform .1s ease;
}
.premium-btn:hover{
  background: var(--amber-bright);
  border-color: var(--amber-bright);
  transform: scale(1.03);
}
.premium-btn:active{ transform: scale(0.98); }

.install-btn{
  display:inline-flex;
  align-items:center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  transition: color .15s ease, transform .1s ease;
}
.install-btn .material-symbols-rounded{
  font-size: 18px;
}
.install-btn:hover{
  color: var(--amber-bright);
  transform: scale(1.03);
}
.install-btn:active{ transform: scale(0.98); }

.bell-btn{
  position: relative;
  font-size: 21px;
  padding: 6px;
  margin-right: 20px;
}
.bell-dot{
  position:absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--bg);
}
.bell-dot[hidden]{ display:none; }

.round-btn{
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 30px;
  display:flex; align-items:center; justify-content:center;
  transition: background .15s ease, transform .1s ease;
}
.round-btn:hover{ background: var(--surface-hover); }
.round-btn:active{ transform: scale(0.94); }
.round-btn.ghost{
  background: transparent;
  border: 1px solid var(--border);
  font-size: 19px;
}
.round-btn.ghost:hover{ border-color: var(--amber); color: var(--amber); }
.clear-history-btn:hover{
  border-color:#e36b6b;
  color:#e36b6b;
}
.clear-history-btn[hidden]{ display:none; }

.header-user{
  display:flex;
  align-items:center;
  margin-left:0;
  gap:10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding-right: 10px;
  border-left: none;
}
.avatar{
  width: 30px; height:30px;
  border-radius:50%;
  background: linear-gradient(145deg, var(--amber), #8a6a2f);
  color:#141118;
  display:flex; align-items:center; justify-content:center;
  font-family: var(--font-display);
  font-weight:700;
  font-size: 13px;
}

/* ======================== PLAYLIST HERO ======================== */
.hero{
  display:flex;
  align-items:flex-end;
  gap: 24px;
  margin-bottom: 26px;
}
.hero-art{
  width: 176px; height: 176px;
  border-radius: var(--radius-md);
  overflow:hidden;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,.6);
  flex-shrink:0;
}
.hero-art img{ width:100%; height:100%; object-fit:cover; }

.hero-eyebrow{
  display:block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
}
.hero-title{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  margin-bottom: 14px;
}
.hero-meta{
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.5;
}

/* ======================== PLAYLIST ACTIONS ======================== */
.action-row{
  display:flex;
  align-items:center;
  gap: 18px;
  margin-bottom: 30px;
}
.playlist-favorite-btn.is-liked{
  color:var(--amber);
  border-color:var(--amber-dim);
}
.playlist-actions-menu-wrap{
  position:relative;
}
.playlist-actions-menu{
  position:absolute;
  top:calc(100% + 8px);
  left:0;
  z-index:40;
  width:220px;
  padding:5px;
  background:#211e23;
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  box-shadow:0 14px 34px rgba(0,0,0,.55);
}
.playlist-actions-menu[hidden]{ display:none; }
.playlist-actions-menu button[hidden]{ display:none; }
.playlist-actions-menu button{
  width:100%;
  display:flex;
  align-items:center;
  gap:9px;
  padding:9px 10px;
  border-radius:var(--radius-sm);
  color:var(--text);
  font-size:12.5px;
  text-align:left;
}
.playlist-actions-menu button:hover{ background:var(--surface-hover); }
.playlist-actions-menu .material-symbols-rounded{
  color:var(--text-muted);
  font-size:17px;
}
.playlist-actions-menu .delete-playlist-option{ color:#f08080; }
.playlist-actions-menu .delete-playlist-option .material-symbols-rounded{ color:#f08080; }
.play-pill{
  width: 52px; height:52px;
  border-radius: 50%;
  background: var(--amber);
  color: #141118;
  font-size: 26px;
  display:flex; align-items:center; justify-content:center;
  transition: transform .12s ease, background .15s ease;
}
.play-pill:hover{ background: var(--amber-bright); transform: scale(1.05); }
.play-pill:active{ transform: scale(0.96); }
.play-pill:disabled{
  opacity:.38;
  cursor:not-allowed;
  transform:none;
}
.play-pill:disabled:hover{
  background:var(--amber);
  transform:none;
}

/* ======================== PLAYLIST SORTING ======================== */
.track-toolbar{
  display:flex;
  justify-content:flex-end;
  margin-top:-18px;
  margin-bottom:10px;
}
.track-sort-wrap{ position:relative; }
.track-sort-btn{
  min-height:34px;
  display:flex;
  align-items:center;
  gap:7px;
  padding:6px 10px;
  border-radius:999px;
  color:var(--text-muted);
  font-size:12px;
  font-weight:600;
  transition:color .15s ease, background .15s ease;
}
.track-sort-btn:hover,
.track-sort-btn[aria-expanded="true"]{
  color:var(--text);
  background:var(--surface-hover);
}
.track-sort-btn > .material-symbols-rounded{ font-size:18px; }
.track-sort-chevron{ font-size:16px !important; }
.track-sort-menu{
  position:absolute;
  top:calc(100% + 6px);
  right:0;
  z-index:40;
  width:196px;
  padding:5px;
  background:#211e23;
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  box-shadow:0 14px 34px rgba(0,0,0,.55);
}
.track-sort-menu[hidden]{ display:none; }
.track-sort-menu button{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:9px 10px;
  border-radius:var(--radius-sm);
  color:var(--text-muted);
  font-size:12.5px;
  text-align:left;
}
.track-sort-menu button:hover{
  color:var(--text);
  background:var(--surface-hover);
}
.track-sort-menu button.is-selected{
  color:var(--amber);
  font-weight:600;
}
.sort-option-check{
  flex-shrink:0;
  font-size:17px;
  opacity:0;
}
.track-sort-menu button.is-selected .sort-option-check{ opacity:1; }

/* ======================== TRACK TABLE ======================== */
.track-table{ padding-bottom: 8px; }

.visually-hidden{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0, 0, 0, 0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.track-row{
  display:grid;
  grid-template-columns: 34px minmax(0, 1fr) 220px 38px 60px;
  align-items:center;
  gap: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}
.track-row--head{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 4px;
}

.track-list .track-row{
  cursor:pointer;
  position:relative;
  transition:background .12s ease, box-shadow .12s ease, opacity .12s ease, transform .12s ease;
}
.track-list .track-row:hover{ background: var(--surface); }
.track-list .track-row:focus-visible{
  outline:2px solid var(--amber);
  outline-offset:2px;
  background:var(--surface);
}
.track-list .track-row.is-active .col-title .t-title{ color: var(--amber); }

/* Custom-playlist rows are grabbed directly; the handle appears only after movement starts. */
.track-list .track-row.is-reorderable{ cursor:grab; }
.track-list .track-row.is-reorderable:active{ cursor:grabbing; }
.track-list .track-row.is-dragging{
  z-index:2;
  cursor:grabbing;
  background:var(--surface-raised);
  box-shadow:0 10px 24px rgba(0,0,0,.42);
  opacity:.62;
  transform:scale(.995);
}
.track-list .track-row.is-drop-before{
  box-shadow:inset 0 2px 0 var(--amber);
}
.track-list .track-row.is-drop-after{
  box-shadow:inset 0 -2px 0 var(--amber);
}
.track-drag-indicator{
  display:none;
  color:var(--amber);
  font-size:19px;
  line-height:1;
}
.track-row.is-dragging .track-drag-indicator{ display:inline-flex; }
.track-row.is-dragging .col-index .idx-num,
.track-row.is-dragging .col-index .eq{ display:none !important; }

.search-empty-state{
  padding: 38px 16px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.col-index{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  text-align:left;
  display:flex;
  align-items:center;
}
.col-title{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width:0;
}
.t-thumb{
  width: 40px; height:40px;
  border-radius: 4px;
  object-fit:cover;
  flex-shrink:0;
}
.t-text{ min-width:0; }
.t-title{
  font-size: 14px;
  font-weight: 600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.t-artist{
  font-size: 12.5px;
  color: var(--text-muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.col-album{
  font-size: 13px;
  color: var(--text-muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.col-add{
  display:flex;
  align-items:center;
  justify-content:center;
}
.track-add-btn{
  width: 32px;
  height: 32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  color: var(--text-muted);
  font-size: 20px;
  opacity:0;
  pointer-events:none;
  transform:scale(.82);
  transition: color .15s ease, background .15s ease, opacity .15s ease, transform .12s ease;
}
.track-row:hover .track-add-btn,
.track-row:focus-within .track-add-btn,
.track-add-btn:focus-visible{
  opacity:1;
  pointer-events:auto;
  transform:scale(1);
}
.track-add-btn:hover{
  color: var(--text);
  background: rgba(255,255,255,.08);
}
.track-add-btn.is-liked-indicator{
  color:#1ed760;
}
.track-add-btn.is-liked-indicator:hover{
  color:#1ed760;
  background:rgba(30,215,96,.12);
}
.track-add-btn.is-liked-indicator .material-symbols-rounded{
  font-variation-settings:'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}
.track-add-btn:active{ transform:scale(.88); }

@media (hover:none){
  .track-add-btn{
    opacity:1;
    pointer-events:auto;
    transform:scale(1);
  }
}
.col-duration{
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  text-align:right;
}

/* Animated equalizer shown beside the active song. */
.eq{
  display:none;
  align-items:flex-end;
  gap: 2px;
  height: 14px;
  width: 16px;
}
.track-row.is-active .eq{ display:flex; }
.track-row.is-active .col-index .idx-num{ display:none; }
.eq span{
  width: 3px;
  background: var(--amber);
  border-radius: 1px;
  animation: eq-bounce 1s ease-in-out infinite;
}
.eq span:nth-child(1){ animation-delay: -0.6s; }
.eq span:nth-child(2){ animation-delay: -0.2s; }
.eq span:nth-child(3){ animation-delay: -0.9s; }
.eq span:nth-child(4){ animation-delay: -0.4s; }
.track-row.is-active.is-paused .eq span{ animation-play-state: paused; }

@keyframes eq-bounce{
  0%, 100% { height: 3px; }
  50% { height: 14px; }
}

/* ======================== BOTTOM PLAYER ======================== */
.player-bar{
  height: 90px;
  background: var(--bg);
  border-top: none;
  display:grid;
  grid-template-columns: 1fr minmax(320px, 640px) 1fr;
  align-items:center;
  padding: 0 20px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.player-now-playing{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width:0;
}
.np-art{
  width: 56px; height:56px;
  border-radius: 50%;
  overflow:hidden;
  border: 1px solid var(--border);
  flex-shrink:0;
  position: relative;
}
.np-art::after{
  content:"";
  position:absolute;
  inset: 38%;
  background: var(--bg);
  border-radius:50%;
  border: 1px solid rgba(255,255,255,.08);
}
.np-art img{
  width:100%; height:100%; object-fit:cover;
  animation: spin 6s linear infinite;
  animation-play-state: paused;
}
.player-bar.is-playing .np-art img{ animation-play-state: running; }
.player-bar.is-loading .np-art img{ animation-play-state: paused; }

@keyframes spin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

.np-text{ min-width:0; }
.np-title{
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-display);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.np-artist{
  font-size: 12px;
  color: var(--text-muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.icon-btn{
  font-size: 21px;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 50%;
  transition: color .15s ease, transform .1s ease;
}
.icon-btn:hover{ color: var(--text); }
.icon-btn:active{ transform: scale(0.9); }
.like-btn{ margin-left: 6px; font-size: 21px; flex-shrink:0; }
.like-btn.is-liked{ color: var(--amber); }

.player-controls{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 8px;
}
.control-buttons{
  display:flex;
  align-items:center;
  gap: 18px;
}
.play-btn{
  width: 34px; height:34px;
  border-radius:50%;
  background: var(--text);
  color: var(--bg);
  display:flex; align-items:center; justify-content:center;
  font-size: 20px;
}
.play-btn:hover{ transform: scale(1.06); background: var(--amber-bright); }
.play-btn.is-loading .material-symbols-rounded,
.play-pill.is-loading .material-symbols-rounded{
  animation:playback-loading-spin .8s linear infinite;
}

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

.progress-row{
  display:flex;
  align-items:center;
  gap: 10px;
  width: 100%;
}
.time-current, .time-duration{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  width: 36px;
  flex-shrink:0;
}
.time-duration{ text-align:right; }

.progress-track, .volume-track{
  position:relative;
  height: 4px;
  background: var(--surface-raised);
  border-radius: 2px;
  flex:1;
  cursor:pointer;
}
.progress-fill, .volume-fill{
  position:absolute;
  left:0; top:0; bottom:0;
  background: var(--text);
  border-radius: 2px;
  width: 0%;
}
.progress-track:hover .progress-fill{ background: var(--amber); }
.progress-track:focus-visible,
.volume-track:focus-visible{
  outline:2px solid var(--amber-bright);
  outline-offset:4px;
}
.progress-track:focus-visible .progress-fill,
.volume-track:focus-visible .volume-fill{
  background:var(--amber);
}
.progress-track:focus-visible .progress-handle,
.volume-track:focus-visible .volume-handle{
  opacity:1;
}
.progress-track.is-disabled{
  cursor:not-allowed;
  opacity:.45;
}
.progress-track.is-disabled:hover .progress-fill{ background:var(--text); }
.control-buttons .icon-btn:disabled{
  opacity:.35;
  cursor:not-allowed;
  transform:none;
}
.progress-handle, .volume-handle{
  position:absolute;
  top:50%;
  width: 11px; height:11px;
  border-radius:50%;
  background: var(--text);
  transform: translate(-50%,-50%);
  left:0%;
  opacity:0;
  transition: opacity .12s ease;
  box-shadow: 0 0 0 3px rgba(0,0,0,.3);
}
.progress-track:hover .progress-handle{ opacity:1; }

.player-extra{
  display:flex;
  align-items:center;
  gap:8px;
  justify-self:end;
  width: 140px;
}
.vol-icon{ font-size: 19px; color: var(--text-muted); }
.volume-btn{
  padding:3px;
  border-radius:50%;
  line-height:1;
}
.volume-btn:hover{ color:var(--text); }
.volume-track{ width: 90px; flex: none; }
.volume-track:hover .volume-handle{ opacity:1; }
.volume-track:hover .volume-fill{ background: var(--amber); }

/* Drawer buttons stay hidden until their responsive breakpoints. */
.responsive-icon-btn,
.drawer-close-btn,
.responsive-now-playing-toggle{
  display:none;
}

.responsive-icon-btn,
.drawer-close-btn{
  width:44px;
  height:44px;
  flex-shrink:0;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  color:var(--text-muted);
  font-size:24px;
  transition:color .15s ease, background .15s ease, transform .1s ease;
}
.responsive-icon-btn:hover,
.drawer-close-btn:hover{
  color:var(--text);
  background:var(--surface-hover);
}
.responsive-icon-btn:active,
.drawer-close-btn:active{ transform:scale(.92); }

.responsive-backdrop{
  position:fixed;
  inset:0;
  z-index:80;
  background:rgba(0,0,0,.7);
  backdrop-filter:blur(4px);
}
.responsive-backdrop[hidden]{ display:none; }

/* Match the Sidebar and Main Content scrollbars. */
.main-content-scroll::-webkit-scrollbar,
.sidebar .playlists::-webkit-scrollbar{
  width:10px;
}
.main-content-scroll::-webkit-scrollbar-thumb,
.sidebar .playlists::-webkit-scrollbar-thumb{
  background-color:transparent;
  background-clip:padding-box;
  border:2px solid transparent;
  border-radius:999px;
  transition:background-color .18s ease;
}
.main-content-scroll::-webkit-scrollbar-track,
.sidebar .playlists::-webkit-scrollbar-track{
  background:transparent;
  margin-block:14px;
}

/* Reveal each dark scrollbar only while its scrollable area is in use. */
.main-content:hover .main-content-scroll,
.sidebar .playlists:hover{
  scrollbar-color:var(--surface-raised) transparent;
}
.main-content:hover .main-content-scroll::-webkit-scrollbar-thumb,
.sidebar .playlists:hover::-webkit-scrollbar-thumb{
  background-color:var(--surface-raised);
}
.now-playing-box::-webkit-scrollbar{ width: 8px; }
.now-playing-box::-webkit-scrollbar-thumb{ background: var(--surface-raised); border-radius: 6px; }
.now-playing-box::-webkit-scrollbar-track{ background: transparent; }

/* ======================== RESPONSIVE LAYOUT ======================== */
/* Tablet: keep the library visible and turn Now Playing into a drawer. */
@media (max-width: 1180px){
  body{ overflow:hidden; }

  .app{
    grid-template-columns:260px minmax(0, 1fr);
    grid-template-rows:70px minmax(0, 1fr);
    height:calc(100dvh - 86px);
    padding-right:8px;
  }

  .sidebar{
    padding:8px 0 6px 10px;
  }
  .brand{
    min-height:50px;
    margin-bottom:10px;
  }
  .brand-logo-img{
    width:44px;
    height:44px;
  }
  .sidebar-box{
    padding:14px;
    overflow:hidden;
  }

  .main-header{
    grid-column:2;
    grid-template-columns:minmax(0, 1fr);
    height:70px;
    padding:8px 0 12px;
  }
  .main-nav-zone{
    grid-template-columns:minmax(0, 1fr);
    width:100%;
  }
  .main-nav-center{
    width:100%;
    max-width:640px;
    gap:10px;
  }
  .main-nav-center > .round-btn{
    width:44px;
    height:44px;
    font-size:25px;
  }
  .search-bar{
    max-width:none;
    height:46px;
  }
  .main-nav-zone .premium-btn,
  .now-playing-nav-zone{ display:none; }

  .main-content-scroll{ padding:28px 28px 36px; }

  .col-album{ display:none; }
  .track-row{ grid-template-columns:34px minmax(0, 1fr) 38px 60px; }

  .now-playing-panel{
    position:fixed;
    left:50%;
    bottom:86px;
    z-index:90;
    width:min(430px, calc(100vw - 24px));
    height:min(720px, calc(100dvh - 110px));
    padding:0;
    visibility:hidden;
    pointer-events:none;
    transform:translate(-50%, calc(100% + 110px));
    transition:transform .28s cubic-bezier(.2,.8,.2,1), visibility .28s;
  }
  body.now-playing-drawer-open .now-playing-panel{
    visibility:visible;
    pointer-events:auto;
    transform:translate(-50%, 0);
  }
  .now-playing-box{
    border-radius:20px 20px 0 0;
    box-shadow:0 -22px 60px rgba(0,0,0,.58);
  }
  .now-playing-drawer-close{ display:flex; }

  .player-bar{
    position:fixed;
    left:0;
    right:0;
    z-index:100;
    height:86px;
    grid-template-columns:minmax(180px, 1fr) minmax(300px, 1.6fr) auto;
    gap:12px;
    padding:0 14px;
  }
  .player-extra{
    width:auto;
    min-width:140px;
  }
  .responsive-now-playing-toggle{
    width:40px;
    height:40px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0;
    font-size:22px;
  }
  .playback-status{ bottom:98px; }
}

/* Compact tablets: preserve the fixed panels while freeing room for tracks. */
@media (max-width: 960px) and (min-width: 761px){
  .app{ grid-template-columns:230px minmax(0, 1fr); }
  .sidebar-box{ padding:13px; }
  .main-content-scroll{ padding:24px 22px 32px; }
  .hero-art{ width:150px; height:150px; }
  .hero{ gap:20px; }
  .hero-title{ font-size:clamp(32px, 5vw, 44px); }

  .player-bar{
    grid-template-columns:minmax(170px, 1fr) minmax(290px, 1.6fr) 48px;
  }
  .player-extra{
    min-width:48px;
    justify-content:center;
  }
  .player-extra .vol-icon,
  .player-extra .volume-track{ display:none; }
}

/* Mobile: the library becomes a left drawer and the player becomes two rows. */
@media (max-width: 760px){
  .app{
    grid-template-columns:minmax(0, 1fr);
    grid-template-rows:64px minmax(0, 1fr);
    column-gap:0;
    height:calc(100dvh - 108px);
    padding-right:0;
  }

  .sidebar{
    position:fixed;
    left:0;
    top:0;
    bottom:108px;
    z-index:90;
    grid-column:auto;
    grid-row:auto;
    width:min(320px, 88vw);
    height:auto;
    padding:10px;
    visibility:hidden;
    pointer-events:none;
    transform:translateX(-105%);
    transition:transform .25s cubic-bezier(.2,.8,.2,1), visibility .25s;
  }
  body.sidebar-drawer-open .sidebar{
    visibility:visible;
    pointer-events:auto;
    transform:translateX(0);
  }
  .sidebar .brand{
    justify-content:space-between;
    margin:0 2px 10px;
  }
  .sidebar-drawer-close{ display:flex; }

  .main-header{
    grid-column:1;
    height:64px;
    padding:8px;
  }
  .main-nav-zone{ display:block; }
  .main-nav-center{
    max-width:none;
    gap:8px;
  }
  .mobile-sidebar-toggle{ display:flex; }
  .main-nav-center > .round-btn{
    font-size:24px;
  }
  .search-bar{
    height:44px;
    padding:0 12px;
    gap:8px;
  }
  .search-bar .material-symbols-rounded{ font-size:24px; }
  .search-input{ font-size:13px; }

  .main{
    grid-column:1;
    padding:0 8px 8px;
  }
  .main-content-scroll{
    padding:22px 16px 28px;
    scrollbar-gutter:auto;
  }

  .hero{
    align-items:center;
    gap:18px;
    margin-bottom:22px;
  }
  .hero-art{
    width:136px;
    height:136px;
  }
  .hero-title{
    margin-bottom:9px;
    font-size:clamp(30px, 7vw, 42px);
  }
  .hero-meta{ font-size:12.5px; }

  .action-row{
    gap:11px;
    margin-bottom:22px;
  }
  .play-pill{ width:48px; height:48px; }
  .round-btn.ghost{ width:44px; height:44px; }
  .track-toolbar{
    margin-top:-8px;
    margin-bottom:8px;
  }
  .track-sort-btn{ min-height:44px; }

  .track-row{
    grid-template-columns:28px minmax(0, 1fr) 38px 54px;
    gap:8px;
    padding:9px 4px;
  }
  .track-add-btn{
    width:36px;
    height:36px;
    opacity:1;
    pointer-events:auto;
    transform:scale(1);
  }

  .now-playing-panel{
    bottom:108px;
    width:calc(100vw - 16px);
    height:min(720px, calc(100dvh - 124px));
  }
  .player-bar{
    height:108px;
    grid-template-columns:minmax(0, 1fr) 48px;
    grid-template-rows:48px 48px;
    gap:0 8px;
    padding:6px 10px;
  }
  .player-now-playing{
    grid-column:1;
    grid-row:1;
    gap:10px;
  }
  .np-art{ width:44px; height:44px; }
  .np-text{
    flex:1;
    max-width:none;
  }
  .like-btn{
    width:40px;
    height:40px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-left:0;
  }
  .player-controls{
    grid-column:1 / 3;
    grid-row:2;
    gap:0;
  }
  .progress-row{ display:none; }
  .control-buttons{
    width:100%;
    justify-content:center;
    gap:clamp(4px, 3vw, 16px);
  }
  .control-buttons .icon-btn{
    width:44px;
    height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0;
  }
  .control-buttons .play-btn{
    width:40px;
    height:40px;
  }
  .player-extra{
    grid-column:2;
    grid-row:1;
    width:48px;
    min-width:48px;
    justify-content:center;
  }
  .player-extra .vol-icon,
  .player-extra .volume-track{ display:none; }
  .responsive-now-playing-toggle{
    width:44px;
    height:44px;
  }

  .playlist-toast{ bottom:116px; }
  .playback-status{ bottom:120px; }
  .cursor-tooltip{ display:none; }
}

/* Small phones: remove secondary header and table details before shrinking text. */
@media (max-width: 520px){
  .main-nav-center > .round-btn{ display:none; }
  .search-divider{ display:none; }

  .demo-feature-toast{
    top:76px;
    left:12px;
    right:12px;
    width:auto;
  }

  .main-content-scroll{ padding:16px 12px 24px; }
  .hero{
    display:grid;
    grid-template-columns:100px minmax(0, 1fr);
    gap:14px;
    margin-bottom:20px;
  }
  .hero-art{
    width:100px;
    height:100px;
  }
  .hero-eyebrow{
    margin-bottom:5px;
    font-size:10px;
  }
  .hero-title{
    margin-bottom:7px;
    font-size:clamp(27px, 8.5vw, 36px);
  }
  .hero-meta{
    display:-webkit-box;
    overflow:hidden;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:3;
    line-clamp:3;
    line-height:1.4;
  }

  .col-duration{ display:none; }
  .track-row{
    grid-template-columns:26px minmax(0, 1fr) 38px;
    gap:7px;
  }
  .t-thumb{ width:38px; height:38px; }
  .t-title{ font-size:13.5px; }
  .t-artist{ font-size:11.5px; }

  .playlist-dialog{
    padding:20px 16px;
    border-radius:14px;
  }
  .track-sort-menu{
    position:fixed;
    left:12px;
    right:12px;
    top:auto;
    bottom:116px;
    width:auto;
  }
  .playlist-actions-menu{
    position:fixed;
    left:12px;
    right:12px;
    top:auto;
    bottom:116px;
    width:auto;
  }
}

@media (max-width: 360px){
  .hero{
    grid-template-columns:88px minmax(0, 1fr);
    gap:12px;
  }
  .hero-art{ width:88px; height:88px; }
  .hero-meta{
    -webkit-line-clamp:2;
    line-clamp:2;
  }
  .control-buttons{ gap:2px; }
  .control-buttons .icon-btn{ width:40px; height:40px; }
}

@media (prefers-reduced-motion: reduce){
  .np-art img, .eq span{ animation: none !important; }
  .play-btn.is-loading .material-symbols-rounded,
  .play-pill.is-loading .material-symbols-rounded{ animation:none !important; }
  .sidebar, .now-playing-panel{ transition:none !important; }
  .track-list .track-row{ transition:none !important; }
  .demo-feature-toast{ animation:none !important; }
}
