:root {
  --bg: #0f1420; --panel: #171e2e; --row: #1c2537; --line: #263049;
  --text: #eef1f7; --muted: #95a0b8; --accent: #e0b25a; --accent-ink: #1b1406;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(340px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center; }
.login img { border-radius: 18px; }
.login h1 { margin: 0 0 8px; font-size: 24px; }
.login input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 17px; }
.login button { width: 100%; padding: 14px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.err { color: #ff8a8a; margin: 0; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.crumb { flex: 1; min-width: 0; font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 22px; text-decoration: none; color: var(--text); flex: none; }
.icon.small { width: 36px; height: 36px; font-size: 17px; color: var(--muted); }
.icon.small.on { color: var(--accent); }
.icon.big { width: 52px; height: 52px; background: var(--accent); color: var(--accent-ink); font-size: 20px; }
#back { font-size: 32px; line-height: 1; }

.search { padding: 12px 16px 0; }
.search input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 16px; }
.actions { display: flex; gap: 10px; padding: 12px 16px 4px; }
.actions[hidden] { display: none; }
.actions button { flex: 1; padding: 11px; border-radius: 12px; background: var(--row); border: 1px solid var(--line); font-weight: 600; }
.actions button:first-child { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* list */
.list { padding: 8px 16px 24px; display: grid; gap: 6px; }
body.has-player .list { padding-bottom: calc(150px + var(--safe-b)); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 12px;
  border-radius: 12px; background: var(--row); text-align: start; }
.row:active { background: var(--line); }
.row .ico { flex: none; width: 24px; text-align: center; color: var(--muted); }
.row .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row .count { flex: none; color: var(--muted); font-size: 13px; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.folder .name { font-weight: 600; }
.row.track.on { background: #2a2414; box-shadow: inset 3px 0 0 var(--accent); }
.row.track.on .ico { color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 24px; }

/* player */
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--panel);
  border-top: 1px solid var(--line); padding: 6px 12px calc(10px + var(--safe-b)); }
.player[hidden] { display: none; }
.player .row { background: none; padding: 0; min-height: 0; gap: 4px; }
.player .meta { flex: 1; min-width: 0; padding-inline-end: 4px; }
.player .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#seek { width: 100%; margin: 0 0 6px; accent-color: var(--accent); height: 22px; }
sup { font-size: 9px; }

@media (max-width: 380px) {
  .icon { width: 40px; height: 40px; }
  .icon.big { width: 48px; height: 48px; }
  .icon.small { width: 30px; }
}
