:root {
  --bg: #0f0b14;
  --bg2: #17111f;
  --card: #1f1729;
  --card2: #2a2036;
  --line: #3a2d4a;
  --text: #f4eefc;
  --muted: #a898bd;
  --accent: #ffb43d;
  --accent2: #ff4f8b;
  --ok: #4fd18b;
  --danger: #ff5d5d;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #3a1c4a 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #4a2a12 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; }

.wrap { max-width: 680px; margin: 0 auto; padding: 16px 16px 80px; }

.brand { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; }
.brand h1 {
  margin: 0; font-size: 26px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .disc {
  width: 34px; height: 34px; border-radius: 50%;
  background: repeating-radial-gradient(circle, #111 0 2px, #2a2a2a 2px 4px);
  box-shadow: inset 0 0 0 11px #111, inset 0 0 0 13px var(--accent);
}
.playing .brand .disc { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* now playing */
.now {
  display: flex; gap: 14px; align-items: center;
  background: linear-gradient(135deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.now .art { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: var(--card2); flex: none; }
.now .meta { min-width: 0; flex: 1; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent); font-weight: 600; }
.now .title { font-size: 18px; font-weight: 700; margin-top: 2px; }
.now .artist { color: var(--muted); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* search */
.search { position: relative; margin: 18px 0 8px; }
.search input {
  width: 100%; padding: 15px 48px 15px 48px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); outline: none; font-size: 17px;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #ffb43d33; }
.search .icon { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; color: var(--muted); display: none; }
.search.has-text .clear { display: block; }
.name-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 0 4px 6px; }
.name-row input { flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px dashed var(--line); padding: 4px 2px; outline: none; }
.name-row input:focus { border-bottom-color: var(--accent); }

h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 22px 4px 8px; font-weight: 600; }

/* track rows */
.list { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px;
  background: var(--card); border: 1px solid transparent;
}
.row.mine { border-color: #ffb43d66; }
.row.auto { background: transparent; opacity: .7; }
.row .num { width: 22px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.row img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--card2); flex: none; }
.row .meta { flex: 1; min-width: 0; }
.row .t { font-weight: 600; }
.row .a { color: var(--muted); font-size: 14px; }
.row .by { font-size: 12px; color: var(--accent); margin-top: 1px; }
.row .dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.btn-add {
  width: 44px; height: 44px; border-radius: 50%; flex: none; font-size: 24px; line-height: 1; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #1a0f00;
  transition: transform .1s;
}
.btn-add:active { transform: scale(.9); }
.btn-add.done { background: var(--ok); font-size: 20px; }
.btn-add[disabled] { background: var(--card2); color: var(--muted); cursor: default; }
.btn-x { width: 36px; height: 36px; border-radius: 50%; color: var(--muted); flex: none; font-size: 18px; }
.btn-x:hover { background: var(--card2); color: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 22px 10px; }
.spinner { width: 26px; height: 26px; margin: 20px auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0;
  background: var(--card2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 999px;
  transition: all .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center; pointer-events: none;
  box-shadow: 0 10px 30px #0008;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--danger); }
.offline { position: fixed; top: 0; left: 0; right: 0; background: var(--danger); color: #fff; text-align: center; font-size: 13px; padding: 4px; display: none; z-index: 60; }
.offline.show { display: block; }

/* ------------------------------------------------------------- player page */
.player-page .wrap { max-width: none; padding: 16px; height: 100vh; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; height: 100%; }
.stage, .side { min-height: 0; display: flex; flex-direction: column; }
.side { overflow-y: auto; padding-right: 4px; }
.side .search { margin-top: 0; }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line); }
.video > div, .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .np { margin-top: 14px; }
.stage .np .title { font-size: 28px; font-weight: 800; }
.stage .np .artist { font-size: 18px; color: var(--muted); }
.stage .np .by { color: var(--accent); margin-top: 4px; }
.controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.ctl { width: 56px; height: 56px; border-radius: 50%; background: var(--card2); font-size: 22px; border: 1px solid var(--line); }
.ctl.main { width: 64px; height: 64px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #1a0f00; border: 0; }
.vol { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.vol input { flex: 1; accent-color: var(--accent); }
.qr-card { margin-top: auto; display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.qr-card img { width: 110px; height: 110px; background: #fff; border-radius: 10px; padding: 4px; flex: none; }
.qr-card .big { font-size: 20px; font-weight: 700; }
.qr-card .url { color: var(--accent); font-size: 18px; word-break: break-all; }

.overlay {
  position: fixed; inset: 0; background: #0f0b14ee; display: flex; align-items: center; justify-content: center;
  z-index: 40; flex-direction: column; gap: 18px; padding: 24px; text-align: center;
}
.overlay[hidden] { display: none; }
.overlay .big-btn {
  padding: 20px 36px; font-size: 22px; font-weight: 700; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #1a0f00;
}
.overlay input { padding: 14px 18px; font-size: 22px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); text-align: center; width: 220px; letter-spacing: 4px; }
.overlay .hint { color: var(--muted); max-width: 420px; }

@media (max-width: 900px) {
  .player-page .wrap { height: auto; }
  .stage-grid { grid-template-columns: 1fr; height: auto; }
  .side { overflow: visible; }
  .stage .np .title { font-size: 22px; }
  .qr-card { margin-top: 16px; }
}
