/* Glazba — topla tamna tema. Bez frameworka, bez builda. */

:root {
  color-scheme: dark;
  --bg: #12100e;
  --bg-2: #1a1714;
  --bg-3: #221e1a;
  --line: #322c26;
  --ink: #f2efe9;
  --ink-2: #a39c91;
  --ink-3: #6f675d;
  --accent: #e08a5c;
  --accent-deep: #c4603a;
  --warn: #e3b23c;
  --ok: #7bb661;
  --mini-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Pravila niže postavljaju display na gotovo svemu, pa bi inače nadjačala
   ono što preglednik radi s atributom hidden. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}
body { min-height: 100dvh; }

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 18px; }
p  { margin: 0; }

.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.warn  { color: var(--warn); }
.error { color: #e4745c; font-size: 13px; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; display: block; }

/* SVG nema hidden svojstvo (to je na HTMLElement), pa pauza ide preko klase. */
.i-pause { display: none; }
.is-playing .i-play { display: none; }
.is-playing .i-pause { display: block; }

.primary, .secondary, .danger {
  border-radius: 12px; padding: 13px 16px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; width: 100%;
}
.primary  { background: var(--accent-deep); color: #fff; }
.secondary{ background: var(--bg-3); border-color: var(--line); }
.danger   { background: transparent; color: #e4745c; border-color: #4a2c26; }
.primary:disabled { opacity: .45; }

.icon-btn { display: grid; place-items: center; width: 40px; height: 40px;
            border-radius: 11px; color: var(--ink); }
.icon-btn:active { background: var(--bg-3); }
.icon-btn.big { width: 46px; height: 46px; }
.icon-btn.big svg { width: 26px; height: 26px; }

.link { color: var(--ink-2); font-size: 18px; line-height: 1; padding: 0 4px; }

/* ─── pune stranice ──────────────────────────────────────────────────── */

.screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
          padding-top: calc(24px + var(--safe-t)); }
.center { text-align: center; gap: 14px; align-content: center; }
.center > * + * { margin-top: 12px; }
.center .primary { width: auto; padding-inline: 22px; margin-top: 18px; }

.gate form { display: grid; gap: 12px; width: min(330px, 86vw); text-align: center; }
.gate-mark img { border-radius: 16px; }
.gate input {
  font: inherit; padding: 13px 15px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink);
}
.gate input:focus { outline: none; border-color: var(--accent-deep); }

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

/* ─── zaglavlje ──────────────────────────────────────────────────────── */

.top {
  padding: calc(14px + var(--safe-t)) 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1c1815, var(--bg));
}
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.stats { display: flex; gap: 22px; margin-top: 14px; }
.stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }

.badge {
  margin-top: 12px; font-size: 12.5px; color: var(--ink-2);
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px;
}
.badge.hint { display: flex; gap: 8px; align-items: center; }
.badge.hint b { color: var(--ink); font-weight: 600; }
.badge.hint .link { margin-left: auto; }

/* ─── popis ──────────────────────────────────────────────────────────── */

.list { padding-bottom: 8px; }
.list-tail { height: calc(var(--mini-h) + var(--safe-b) + 24px); }

.block-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 10px;
  background: rgba(18,16,14,.86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.block-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; }
.block-head p  { font-size: 12px; color: var(--ink-3); }
.block-head .icon-btn { margin-left: auto; color: var(--accent); flex: none; }

.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 16px; text-align: left; border-bottom: 1px solid #201c19;
}
.row:active { background: var(--bg-2); }
.row.current { background: #1e1915; }

.rating {
  width: 18px; flex: none; text-align: center;
  font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ink-3);
}
.row.current .rating { color: var(--accent); }

.row-text { min-width: 0; flex: 1; }
.row-text b { display: block; font-size: 15px; font-weight: 500;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-text i { display: block; font-style: normal; font-size: 12.5px; color: var(--ink-2);
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.current .row-text b { color: var(--accent); font-weight: 600; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.len { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }

/* ─── omot ───────────────────────────────────────────────────────────── */

/* Omoti su YouTube hqdefault (480×360) s crnim rubovima gore i dolje.
   Sadržaj je srednjih 480×270 — ova tri broja ga izrežu u kvadrat. */
.art { position: relative; overflow: hidden; border-radius: 10px; flex: none;
       background: linear-gradient(135deg, var(--accent) 0%, #a33b6a 100%); }
.art img { position: absolute; width: 177.8%; height: auto; left: -38.9%; top: -16.7%;
           opacity: 0; transition: opacity .25s; }
.art img.on { opacity: 1; }
.art-sm { width: 42px; height: 42px; }
.art-lg { width: min(66vw, 300px); height: min(66vw, 300px); border-radius: 16px;
          box-shadow: 0 18px 40px rgba(0,0,0,.45); }

/* ─── mini player ────────────────────────────────────────────────────── */

.mini {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 30;
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  height: var(--mini-h);
  background: rgba(34,30,26,.92);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.mini-bar { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 2px;
            background: #3a332c; border-radius: 2px; overflow: hidden; }
.mini-fill, #mini-fill { display: block; height: 100%; width: 0; background: var(--accent); }
.mini-open { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-align: left; }
.mini-text { min-width: 0; }
.mini-text b { display: block; font-size: 13.5px; font-weight: 600;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text i { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-2);
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── listovi ────────────────────────────────────────────────────────── */

.sheet {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: rise .26s cubic-bezier(.22,.7,.3,1);
}
@keyframes rise { from { transform: translateY(100%); } }
.sheet.closing { animation: sink .2s ease-in forwards; }
@keyframes sink { to { transform: translateY(100%); } }

.sheet-inner {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: calc(10px + var(--safe-t)) 22px calc(28px + var(--safe-b));
  text-align: center;
}
.sheet-inner.left { align-items: stretch; text-align: left; gap: 14px; }

.grabber { width: 44px; height: 5px; border-radius: 3px; background: #4a423a; flex: none;
           margin: 4px auto 6px; }

.eyebrow { font-size: 11.5px; font-weight: 650; letter-spacing: .09em;
           text-transform: uppercase; color: var(--ink-3); }

.now-text { max-width: 92%; }
.now-text h2 { font-size: 19px; line-height: 1.3; }
.now-text p { margin-top: 3px; font-size: 14.5px; }

.scrub { width: 100%; max-width: 420px; }
.scrub-time { display: flex; justify-content: space-between; font-size: 11.5px;
              color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: -2px; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 26px;
  background: none; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--pct,0%), #3a332c var(--pct,0%));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); margin-top: -5px;
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 3px; background: #3a332c; }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 3px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ink); }

.transport { display: flex; align-items: center; gap: 38px; }
.play-btn { width: 70px; height: 70px; border-radius: 50%; background: var(--accent-deep);
            color: #fff; display: grid; place-items: center; }
.play-btn svg { width: 32px; height: 32px; }
.play-btn:active { background: #a74f2e; }

.now-foot { font-size: 12.5px; color: var(--ink-3); line-height: 1.7;
            font-variant-numeric: tabular-nums; margin-top: auto; }
.now-foot b { color: var(--accent); font-weight: 600; }

/* ─── offline ────────────────────────────────────────────────────────── */

.kv { margin: 6px 0 0; display: grid; gap: 1px; background: var(--line);
      border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv > div { display: flex; justify-content: space-between; gap: 12px;
            padding: 11px 14px; background: var(--bg-2); }
.kv dt { color: var(--ink-2); font-size: 14px; margin: 0; }
.kv dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }

.bar { height: 6px; border-radius: 4px; background: var(--bg-3);
       border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent);
         transition: width .25s; }

.sheet-actions { display: grid; gap: 10px; margin-top: 4px; }

/* ─── toast ──────────────────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--mini-h) + var(--safe-b) + 22px); z-index: 60;
  background: #2e2823; border: 1px solid var(--line); color: var(--ink);
  padding: 10px 16px; border-radius: 999px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 88vw; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
