:root {
  --bg: #0f1115;
  --bg-soft: #151821;
  --card: #191d27;
  --card-2: #20242f;
  --line: #262a35;
  --text: #e9ecf2;
  --muted: #8b93a7;
  --pink: #fb7299;
  --pink-deep: #e35c85;
  --danger: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------- auth */

.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(251,114,153,.16), transparent 60%),
    radial-gradient(700px 420px at 85% 100%, rgba(90,120,255,.12), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(25, 29, 39, .88);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
.brand p { margin: 2px 0 0; font-size: 12px; }
.brand.small strong { font-size: 15px; }

.logo {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), #ff9f68);
  box-shadow: 0 6px 18px rgba(251,114,153,.35);
}
.brand.small .logo { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }

.tabs {
  display: flex;
  gap: 6px;
  background: #12151c;
  padding: 4px;
  border-radius: 12px;
  margin: 22px 0 18px;
}
.tab {
  flex: 1;
  padding: 9px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  transition: .18s;
}
.tab.active { background: var(--card-2); color: var(--text); }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 11px;
  background: #12151c;
  border: 1px solid var(--line);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(251,114,153,.16);
}

.btn {
  padding: 10px 16px;
  border-radius: 11px;
  font-weight: 600;
  background: var(--card-2);
  transition: .16s;
}
.btn:hover { filter: brightness(1.12); }
.btn.primary { background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; padding: 12px; margin-top: 4px; }
.btn.danger { color: var(--danger); }

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255,107,107,.1);
}
.hint { font-size: 12px; color: var(--muted); margin: 16px 0 0; text-align: center; }

/* ------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 60px 1fr 84px;
  grid-template-areas: "top top" "side main" "player player";
  height: 100%;
  height: 100dvh;
}

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,17,21,.86);
  backdrop-filter: blur(10px);
  z-index: 20;
}
.search { flex: 1; max-width: 460px; }
.search input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  background: #12151c;
  border: 1px solid var(--line);
  outline: none;
}
.search input:focus { border-color: #3a3f4d; }

.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), #ff9f68);
  color: #fff; font-weight: 700;
}
.menu {
  position: absolute;
  top: 52px; right: 0;
  width: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 6px;
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
  z-index: 30;
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; }
.menu-head span { font-size: 12px; }
.menu button {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 9px;
}
.menu button:hover { background: var(--card-2); }

/* ------------------------------------------------------------- sidebar */

.sidebar {
  grid-area: side;
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-align: left;
  width: 100%;
  font-weight: 600;
}
.nav:hover { background: var(--card); color: var(--text); }
.nav.active { background: var(--card-2); color: var(--text); }
.nav .ico { width: 18px; text-align: center; color: var(--pink); }

.side-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 6px;
  padding: 0 12px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .4px;
}
.mini {
  width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--muted);
}
.mini:hover { background: var(--card-2); color: var(--text); }

.playlist-list { overflow-y: auto; flex: 1; }
.pl-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  width: 100%;
  text-align: left;
  font-size: 13px;
}
.pl-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-item:hover { background: var(--card); color: var(--text); }
.pl-item.active { background: var(--card-2); color: var(--text); }
.pl-count { margin-left: auto; font-size: 11px; opacity: .6; }

.storage { padding: 12px; border-top: 1px solid var(--line); margin-top: 8px; }
.storage-bar {
  height: 5px; border-radius: 3px; background: #242835; overflow: hidden; margin-bottom: 7px;
}
.storage-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--pink), #ff9f68);
  transition: width .4s;
}
.storage span { font-size: 11px; }

/* ------------------------------------------------------------- content */

.content {
  grid-area: main;
  overflow-y: auto;
  padding: 22px 24px 32px;
}
.content-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.content-head h2 { margin: 0; font-size: 20px; }
.content-head .muted { font-size: 12px; }

.dropzone {
  border: 1.5px dashed #2c3140;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 18px;
  transition: .2s;
  font-size: 13px;
}
.dropzone.over { border-color: var(--pink); background: rgba(251,114,153,.06); }
.dropzone small { display: block; margin-top: 6px; font-size: 11px; opacity: .7; }
.link { color: var(--pink); text-decoration: underline; padding: 0; }

.track-list { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 34px 1fr 150px 78px 70px 64px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  border-bottom: 1px solid rgba(38,42,53,.6);
}
.row:hover { background: rgba(255,255,255,.03); }
.row.playing .t-title { color: var(--pink); }
.row .idx { color: var(--muted); font-size: 12px; text-align: center; }
.row .t-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t-album, .row .t-size { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: .15s; }
.row:hover .actions, .row .actions.show { opacity: 1; }
.row .icon-btn { width: 28px; height: 28px; border-radius: 8px; color: var(--muted); }
.row .icon-btn:hover { background: var(--card-2); color: var(--text); }
.row .icon-btn.on { color: var(--pink); }
.row .t-ext {
  font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; justify-self: start;
}

.empty { text-align: center; padding: 60px 0; color: var(--muted); }
.empty-ico { font-size: 34px; opacity: .35; margin-bottom: 8px; }

/* ------------------------------------------------------------- player */

.player {
  grid-area: player;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  background: rgba(18,21,28,.94);
  backdrop-filter: blur(14px);
}
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cover {
  width: 46px; height: 46px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2a2f3d, #1b1f29);
  color: var(--muted);
  flex: none;
}
.now-text { min-width: 0; }
.now-text strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-text span { font-size: 11px; }

.controls { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--muted); font-size: 15px;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.play-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff; font-size: 16px;
  box-shadow: 0 6px 16px rgba(251,114,153,.32);
}
.play-btn:hover { filter: brightness(1.08); }

.progress {
  display: flex; align-items: center; gap: 10px;
  justify-self: end; width: 100%; max-width: 380px;
}
.progress span { font-size: 11px; color: var(--muted); min-width: 34px; text-align: center; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px;
  background: #2a2f3d;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--pink);
  cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--pink);
}
#seek { flex: 1; }
#volume { width: 74px; }

/* ------------------------------------------------------------- upload */

.upload-panel {
  position: fixed; right: 20px; bottom: 100px;
  width: 320px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 18px 44px rgba(0,0,0,.5);
  z-index: 40;
}
.up-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 13px; }
.up-item { margin-bottom: 10px; font-size: 12px; }
.up-item .nm { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.up-item .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 4px; border-radius: 2px; background: #242835; overflow: hidden; }
.up-bar i { display: block; height: 100%; background: var(--pink); width: 0; transition: width .2s; }

/* ------------------------------------------------------------- modal */

.modal {
  position: fixed; inset: 0;
  background: rgba(5,7,10,.6);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 50;
  padding: 20px;
}
.modal-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.modal-card h3 { margin: 0 0 14px; font-size: 16px; }
.modal-card input, .modal-card select {
  width: 100%; padding: 11px 13px; margin-bottom: 10px;
  border-radius: 10px; background: #12151c;
  border: 1px solid var(--line); outline: none;
}
.modal-card input:focus { border-color: var(--pink); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.session-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px;
}
.session-row:last-child { border-bottom: 0; }

/* ------------------------------------------------------------- toast */

.toasts {
  position: fixed; left: 50%; bottom: 100px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60; pointer-events: none;
}
.toast {
  padding: 10px 16px; border-radius: 10px;
  background: #262b38; border: 1px solid #333a4a;
  font-size: 13px;
  animation: rise .22s ease-out;
  box-shadow: 0 10px 26px rgba(0,0,0,.4);
}
.toast.bad { border-color: rgba(255,107,107,.4); color: #ffb3b3; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr 76px;
    grid-template-areas: "top" "main" "player";
  }
  .sidebar { display: none; }
  .content { padding: 16px 14px 24px; }
  .row { grid-template-columns: 28px 1fr 64px 58px; }
  .row .t-album, .row .t-size { display: none; }
  .progress { max-width: none; }
  .progress #volume { display: none; }
  .now-text { max-width: 28vw; }
}

/* ------------------------------------------------------------- small screens */

@media (max-width: 620px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand.small strong { display: none; }
  #uploadBtn { display: none; }
  .search { max-width: none; min-width: 0; }
  .search input { padding: 8px 12px; font-size: 13px; }
  .player { grid-template-columns: auto 1fr; gap: 8px; padding: 0 12px; }
  .now { display: none; }
  .controls { gap: 6px; }
  .progress { max-width: none; gap: 6px; }
  .progress span { min-width: 30px; font-size: 10px; }
  .content-head h2 { font-size: 18px; }
}

@media (hover: none) {
  .row .actions { opacity: 1; }
}
