:root {
  --bg: #0b0b0d;
  --panel: #15161a;
  --panel-2: #1d1f25;
  --text: #ececf0;
  --muted: #8b8d96;
  --accent: #ff5b3a;
  --line: #25272e;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(11,11,13,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 700; font-size: 17px; letter-spacing: .3px; padding: 6px 8px; }
.search { flex: 1; display: flex; gap: 6px; }
.search input {
  flex: 1; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.search button { padding: 0 14px; font-size: 18px; color: var(--muted); }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }

.splash { padding: 60px 16px; text-align: center; }
.splash h2 { margin: 0 0 6px; font-weight: 600; }
.muted { color: var(--muted); }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card { cursor: pointer; }
.card .thumb {
  width: 100%; aspect-ratio: 16/9; background: var(--panel);
  border-radius: 10px; overflow: hidden; position: relative;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .dur {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,.78); color: #fff; font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
}
.card .title { margin-top: 8px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .ch { color: var(--muted); font-size: 13px; margin-top: 2px; }

.player { padding-bottom: 60px; }
.stage {
  position: relative; background: #000; border-radius: 12px; overflow: hidden;
  aspect-ratio: 16/9;
}
.stage canvas { width: 100%; height: 100%; display: block; background: #000; }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
  opacity: 0; transition: opacity .2s;
  z-index: 2;
}
.stage:hover .controls, .stage:focus-within .controls, .controls.show { opacity: 1; }
.controls button { font-size: 18px; padding: 4px 8px; }
.controls #seek { flex: 1; }
.controls #vol { width: 80px; }
.controls #time { font-variant-numeric: tabular-nums; color: #ddd; font-size: 13px; }
input[type=range] { accent-color: var(--accent); }

.loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.45);
  pointer-events: none;
}
.spin {
  width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff; border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player h1 { font-size: 20px; margin: 14px 0 6px; }
.meta { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.desc { white-space: pre-wrap; color: #c9cbd2; font-size: 14px; max-height: 220px; overflow: auto; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }

@media (max-width: 540px) {
  .controls { opacity: 1; }
  .player h1 { font-size: 17px; }
}
