:root {
  color-scheme: dark;
  --bg: #111827;
  --card: #1f2937;
  --card-2: #374151;
  --text: #f9fafb;
  --muted: #9ca3af;
  --primary: #22c55e;
  --danger: #ef4444;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: linear-gradient(180deg, #0f172a, #111827);
  color: var(--text);
}
header, main {
  width: min(1250px, calc(100% - 32px));
  margin: 0 auto;
}
header {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  padding: 24px 0;
  align-items: start;
}
.player-box, .card {
  background: rgba(31, 41, 55, 0.9);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
main { padding-bottom: 32px; }
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid.one { display: grid; grid-template-columns: 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.item, .playlist-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(55, 65, 81, 0.5);
}
.item.compact { padding: 0; background: transparent; }
.playlist-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(17, 24, 39, 0.45);
  border: 1px solid rgba(255,255,255,0.06);
}
button, input, select, label {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 10px 12px;
  background: #0f172a;
  color: var(--text);
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
}
button {
  background: var(--primary);
  color: #06280f;
  font-weight: 700;
  cursor: pointer;
}
button.danger { background: var(--danger); color: white; }
.actions, .player-actions { display: flex; gap: 8px; }
.actions.wrap { flex-wrap: wrap; justify-content: flex-end; }
.muted { color: var(--muted); font-size: 0.92rem; }
.playlist-song-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(55, 65, 81, 0.35);
}
.order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.08);
}
.download-progress {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.65);
  border: 1px solid rgba(255,255,255,0.08);
}
.progress-track {
  width: 100%;
  height: 16px;
  margin: 10px 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
}
.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #86efac);
  transition: width 0.25s ease;
}
.editor-card { display: flex; flex-direction: column; gap: 16px; }
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.timeline-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
}
#editorSeek { width: 100%; accent-color: #22c55e; }
.marker-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
}
.editor-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}
.inset-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(17, 24, 39, 0.75);
}
.hidden { display: none; }
@media (max-width: 900px) {
  header, .layout, .grid.two, .editor-grid { grid-template-columns: 1fr; }
  .marker-row { grid-template-columns: 1fr; }
  .item, .playlist-controls, .editor-header { align-items: stretch; flex-direction: column; }
}

.playback-card { gap: 14px; }
.playback-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.editor-playback-actions { justify-content: flex-start; }
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px 14px;
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}
@media (max-width: 900px) {
  .shortcut-grid { grid-template-columns: 1fr; }
  .playback-top-row { flex-direction: column; align-items: flex-start; }
}


.topbar {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.08);
  background: #0f172a;
  color: var(--text);
  font-weight: 700;
}
.home-player-card {
  width: min(950px, 100%);
  margin: 0 auto;
}
.selector-grid { margin-bottom: 14px; }
.compact-player-box { padding: 0; background: transparent; border: none; box-shadow: none; }
#editorSeek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  --range-progress: 0%;
}
#editorSeek::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0, var(--primary) var(--range-progress), rgba(255,255,255,0.18) var(--range-progress), rgba(255,255,255,0.18) 100%);
}
#editorSeek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.22);
}
#editorSeek::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}
#editorSeek::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
}
#editorSeek::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.22);
}
hr {
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 16px 0;
}
@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: flex-start; }
}


.hidden-songs-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.08); }
.song-select[multiple] { min-height: 140px; }
.is-hidden-song { opacity: 0.88; }

.playlist-collapse-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.playlist-select-hint {
  margin-top: -4px;
}

.song-select {
  min-height: 120px;
}

.section-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.playlist-collapse-area.hidden,
#hiddenSongsList.hidden {
  display: none !important;
}


body { overflow-x: hidden; }
header, main, .layout, .card, .item, .playlist-block, .playlist-song-row, .playlist-controls, .actions, .actions.wrap, .player-actions, .editor-header, .playback-top-row { min-width: 0; }
.item > div:first-child, .playlist-song-row > div:nth-child(2) { min-width: 0; }
.song-title, .playlist-name, .playlist-song-row strong { overflow-wrap: anywhere; }
.song-meta, .playlist-description, .muted { overflow-wrap: anywhere; }
.playlist-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.song-select, .move-playlist-select, input, select, audio { width: 100%; max-width: 100%; }
.actions.wrap { align-items: center; }
.playlist-song-row .actions.wrap { justify-content: flex-end; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .playlist-song-row { grid-template-columns: 1fr; }
  .order-badge { display: none; }
  .playlist-controls { grid-template-columns: 1fr; }
  .playlist-song-row .actions.wrap { justify-content: flex-start; }
}


button.secondary {
  background: #334155;
  color: var(--text);
}

.hidden-songs-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.is-hidden-song {
  opacity: 0.76;
  border: 1px dashed rgba(255,255,255,0.12);
}

.section-toggle-row h2,
.hidden-songs-section h3 {
  margin: 0;
}

/* Home player redesign only */
body[data-page="home"] {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(72, 117, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.12), transparent 24%),
    linear-gradient(135deg, #061224 0%, #08182b 45%, #09111d 100%);
}

body[data-page="home"] .home-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

body[data-page="home"] .home-wallpaper {
  position: fixed;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 220ms ease;
  pointer-events: none;
}

body[data-page="home"].has-home-wallpaper .home-wallpaper {
  opacity: 1;
}

body[data-page="home"] .home-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

body[data-page="home"] .home-topbar,
body[data-page="home"] .home-main {
  position: relative;
  z-index: 1;
}

body[data-page="home"] .home-main {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 48px;
}

body[data-page="home"] .topbar.home-topbar {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 20px;
  padding: 24px 28px;
}

body[data-page="home"] .glass-card {
  background: rgba(10, 19, 34, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body[data-page="home"] .eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b8c8ee;
  background: rgba(255, 255, 255, 0.06);
}

body[data-page="home"] .home-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 24px 28px;
  border-radius: 26px;
}

body[data-page="home"] .home-now-playing-label {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #95a8d5;
  margin-bottom: 10px;
}

body[data-page="home"] .home-current-song {
  margin: 0;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.08;
  color: #f5f8ff;
  text-wrap: balance;
}

body[data-page="home"] .home-subtext {
  margin-top: 12px;
  max-width: 700px;
}

body[data-page="home"] .home-hero-right {
  min-width: 240px;
}

body[data-page="home"] .home-hero-right label,
body[data-page="home"] .home-selector-grid label {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body[data-page="home"] .home-player-card {
  padding: 18px;
  border-radius: 28px;
}

body[data-page="home"] .home-selector-grid {
  margin-bottom: 18px;
}

body[data-page="home"] .home-player-box {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

body[data-page="home"] #audioPlayer {
  width: 100%;
  border-radius: 16px;
}

body[data-page="home"] .home-player-actions {
  margin-top: 16px;
}

body[data-page="home"] select,
body[data-page="home"] .nav-link,
body[data-page="home"] button {
  border-radius: 16px;
}

body[data-page="home"] code {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 800px) {
  body[data-page="home"] .home-hero {
    flex-direction: column;
    align-items: stretch;
  }

  body[data-page="home"] .home-hero-right {
    min-width: 0;
  }
}


/* Minimal Player Home */
body[data-page="home"] {
  min-height: 100vh;
  background: #05070b;
  overflow: hidden;
}
body[data-page="home"] .minimal-home-shell {
  position: relative;
  min-height: 100vh;
  width: 100%;
}
body[data-page="home"] .home-wallpaper {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: none;
  transform: scale(1.02);
}
body[data-page="home"] .minimal-home-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
}
body[data-page="home"] .minimal-home-stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
body[data-page="home"] .home-editor-link {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 30;
  min-height: auto;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: rgba(255,255,255,0.94);
  background: rgba(10,12,18,0.34);
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(0,0,0,0.18);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
body[data-page="home"] .player-ui {
  position: relative;
  z-index: 10;
  width: min(720px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease;
}
body[data-page="home"] .minimal-now-playing {
  max-width: min(88vw, 760px);
  padding: 0 12px;
}
body[data-page="home"] .minimal-track {
  font-size: clamp(1rem, 1.45vw, 1.45rem);
  line-height: 1.35;
  color: rgba(255,255,255,0.96);
  text-align: center;
  text-shadow: 0 2px 14px rgba(0,0,0,0.45);
  word-break: break-word;
}
body[data-page="home"] .minimal-audio-card {
  width: min(640px, calc(100vw - 42px));
  padding: 20px;
  border-radius: 24px;
  background: rgba(250,250,252,0.82);
  border: 1px solid rgba(255,255,255,0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 65px rgba(0,0,0,0.28);
}
body[data-page="home"] #audioPlayer {
  width: 100%;
  display: block;
}
body[data-page="home"] .minimal-actions,
body[data-page="home"] .minimal-selectors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
body[data-page="home"] .minimal-actions button,
body[data-page="home"] .minimal-selectors select {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(14,16,21,0.44);
  color: rgba(255,255,255,0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
body[data-page="home"] .minimal-actions button {
  cursor: pointer;
  font-weight: 600;
}
body[data-page="home"] .minimal-selectors select {
  min-width: min(220px, 42vw);
  max-width: min(280px, 46vw);
}
body[data-page="home"] .ui-hidden-hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 8;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(8,10,14,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  pointer-events: none;
  font-size: 0.92rem;
}
body[data-page="home"].player-ui-hidden .player-ui,
body[data-page="home"].player-ui-hidden .home-editor-link {
  opacity: 0;
  transform: translateY(10px);
  visibility: hidden;
  pointer-events: none;
}
body[data-page="home"].player-ui-hidden .ui-hidden-hint {
  opacity: 1;
  visibility: visible;
}
@media (max-width: 640px) {
  body[data-page="home"] .minimal-home-stage { padding: 18px; }
  body[data-page="home"] .player-ui { width: min(100%, calc(100vw - 18px)); gap: 14px; }
  body[data-page="home"] .minimal-audio-card { width: min(100%, calc(100vw - 22px)); padding: 14px; border-radius: 20px; }
  body[data-page="home"] .minimal-selectors { width: 100%; }
  body[data-page="home"] .minimal-selectors select { min-width: 0; width: calc(50% - 6px); max-width: none; }
  body[data-page="home"] #wallpaperSelect { width: 100%; }
  body[data-page="home"] .home-editor-link { top: 14px; right: 14px; }
}


body[data-page="home"] {
  min-height: 100vh;
  min-height: 100dvh;
}

@media (display-mode: standalone) {
  body[data-page="home"] {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .home-editor-link {
    top: calc(18px + env(safe-area-inset-top, 0));
    right: calc(18px + env(safe-area-inset-right, 0));
  }
}
