:root {
  --bg: #0e0b1a;
  --panel: #1a1530;
  --panel-2: #241d42;
  --line: #352c5c;
  --text: #f2eefc;
  --muted: #a49cc4;
  --accent: #ff3d8b;
  --accent-2: #7c5cff;
  --ok: #2fd18a;
  --danger: #ff5a5a;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
button, input { font: inherit; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: .5px; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }
.nav { display: flex; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; margin-left: 14px; font-weight: 600; white-space: nowrap; }
.nav a.active, .nav a:hover { color: var(--text); }

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

.btn { background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 16px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 10px; font-size: .85rem; }

.input { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px 14px; outline: none; }
.input:focus { border-color: var(--accent-2); }

.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; font-size: 1.05rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; }
.card .thumb { position: relative; aspect-ratio: 16/9; background: #000; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .ext-tag { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.8); color: #ffd23d;
  font-size: .75rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.card .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.8);
  font-size: .8rem; padding: 2px 6px; border-radius: 4px; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.card .channel { color: var(--muted); font-size: .82rem; }
.card .actions { margin-top: auto; display: flex; gap: 6px; padding-top: 6px; }
.card .actions .btn { flex: 1; }

.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.row img { width: 112px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.row .pos { font-weight: 800; font-size: 1.3rem; width: 34px; text-align: center; color: var(--accent); flex-shrink: 0; }
.row .info { flex: 1; min-width: 0; }
.row .info .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .info .singer { color: var(--muted); font-size: .9rem; }
.row .tools { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.row.now { border-color: var(--accent); background: linear-gradient(90deg, rgba(255,61,139,.18), var(--panel)); }

.section-title { margin: 22px 0 10px; font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--ok); color: #04210f; font-weight: 700; padding: 12px 20px; border-radius: 10px;
  transition: transform .25s; z-index: 100; max-width: calc(100% - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: #fff; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex;
  align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; width: 100%; max-width: 420px; }
.modal img { width: 100%; border-radius: 10px; }
.modal h3 { margin: 12px 0 4px; font-size: 1.05rem; }
.modal .btns { display: flex; gap: 8px; margin-top: 14px; }
.modal .btns .btn { flex: 1; }

.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .topbar { padding: 12px; gap: 8px; }
  .brand { font-size: 1rem; white-space: nowrap; }
  .nav a { margin-left: 10px; font-size: .82rem; }
  .row img { width: 80px; }
  .row .tools .btn { padding: 6px 8px; }
}
