:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #151821;
  --surface-2: #1d2130;
  --text: #f2f4f8;
  --muted: #9aa2b4;
  --accent: #ff4d6d;
  --accent-2: #ff8a5b;
  --green: #35d07f;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #2a1030 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(76px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px 10px;
  gap: 10px;
}
.brand { font-weight: 800; letter-spacing: .04em; font-size: 15px; }
.brand-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); margin-right: 7px;
  box-shadow: 0 0 14px var(--accent);
}
.brand-light { color: var(--muted); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  font-size: 11px; padding: 5px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill-on { background: rgba(53, 208, 127, .14); color: var(--green); }
.pill-off { background: rgba(255, 77, 109, .14); color: var(--accent); }

main { flex: 1; }
.view { display: none; animation: fade .18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.art-wrap { position: relative; margin: 8px 0 22px; }
.art-wrap img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  border-radius: 22px; background: var(--surface);
  box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04);
}
.badge {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(10,10,14,.72); backdrop-filter: blur(10px);
  padding: 6px 11px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid rgba(255,255,255,.08);
}

.meta h1 { font-size: 24px; line-height: 1.2; margin: 0 0 5px; letter-spacing: -.02em; }
.meta p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.like-row { display: flex; gap: 8px; }
.chip {
  border: 1px solid rgba(255,255,255,.1); background: var(--surface);
  padding: 7px 12px; border-radius: 999px; font-size: 12px;
}
.chip.active { color: var(--accent); border-color: rgba(255,77,109,.5); background: rgba(255,77,109,.12); }

.progress { margin: 24px 0 12px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px;
  background: transparent; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px; background: rgba(255,255,255,.16);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); margin-top: -5px; box-shadow: 0 0 12px rgba(255,77,109,.6);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.16); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--accent); }
.times { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: -2px; }

.controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px; margin: 6px 0 18px;
}
.ctrl {
  border: 0; background: transparent; font-size: 22px; width: 46px; height: 46px;
  border-radius: 14px; display: grid; place-items: center; transition: transform .12s, background .12s;
}
.ctrl:active { transform: scale(.9); background: var(--surface-2); }
.ctrl.small { font-size: 17px; width: 38px; color: var(--muted); position: relative; }
.ctrl.small span { font-size: 9px; position: absolute; bottom: 6px; right: 6px; }
.ctrl.play {
  width: 62px; height: 62px; font-size: 26px; color: #14090d;
  background: linear-gradient(145deg, #fff 0%, #ffd9df 100%);
  box-shadow: 0 10px 26px rgba(255,77,109,.28);
}
.ctrl.active { color: var(--accent); }

.volume-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.volume-row input { flex: 1; }
.icon-btn {
  border: 0; background: var(--surface-2); border-radius: 12px;
  width: 38px; height: 38px; display: grid; place-items: center; font-size: 16px;
}
.volume-value { font-size: 11px; color: var(--muted); width: 38px; text-align: right; }
.status-line { margin-top: 12px; font-size: 11px; color: var(--muted); text-align: center; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 10px 0 14px; }
.section-head h2, .card h2 { margin: 0; font-size: 19px; }
.muted { color: var(--muted); font-size: 12px; }

.search-box { margin: 10px 0 16px; }
.search-box input, .card input {
  width: 100%; background: var(--surface); border: 1px solid rgba(255,255,255,.08);
  color: var(--text); border-radius: 14px; padding: 13px 15px; outline: none;
}
.search-box input:focus, .card input:focus { border-color: rgba(255,77,109,.6); }

.list { display: flex; flex-direction: column; gap: 8px; }
.empty, .err { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.err { color: var(--accent); }
.row {
  display: flex; align-items: center; gap: 12px; padding: 9px;
  background: var(--surface); border-radius: 14px; border: 1px solid transparent;
}
.row.selected { border-color: rgba(255,77,109,.45); background: rgba(255,77,109,.08); }
.row img { width: 50px; height: 50px; object-fit: cover; border-radius: 9px; background: var(--surface-2); flex: none; }
.row .info { flex: 1; min-width: 0; }
.row .info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .info span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.row-actions { display: flex; gap: 4px; }
.mini {
  border: 0; background: var(--surface-2); border-radius: 9px;
  width: 32px; height: 32px; font-size: 13px;
}

.card {
  background: var(--surface); border-radius: var(--radius); padding: 18px;
  margin-bottom: 14px; border: 1px solid rgba(255,255,255,.04);
}
.card label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.buttons-row { display: flex; gap: 8px; margin-top: 16px; }
.primary, .secondary {
  border: 0; border-radius: 12px; padding: 11px 16px; font-size: 13px; font-weight: 600;
}
.primary { background: var(--accent); color: #fff; }
.secondary { background: var(--surface-2); }
.card ol { padding-left: 20px; color: var(--muted); font-size: 12px; line-height: 1.8; }
code { background: rgba(255,255,255,.07); padding: 2px 5px; border-radius: 5px; font-size: 11px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 560px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(16,18,25,.92); backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  font-size: 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px;
}
.tab span { font-size: 19px; line-height: 1; }
.tab.active { color: var(--accent); }

@media (min-width: 700px) {
  #app { padding-top: 10px; }
  .art-wrap img { max-height: 46vh; width: auto; margin: 0 auto; }
}
