:root {
  --cols: 3;
  --gap: 10px;
  --bg: #0e0e12;
  --fg: #f2f2f5;
  --muted: #8d8d99;
  --accent: #1ed760;
  --footer-h: 72px;
}
@media (min-width: 700px)  { :root { --cols: 4; } }
@media (min-width: 1000px) { :root { --cols: 5; } }
@media (min-width: 1400px) { :root { --cols: 6; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: calc(env(safe-area-inset-top) + var(--gap)) calc(env(safe-area-inset-right) + var(--gap))
  calc(var(--footer-h) + env(safe-area-inset-bottom) + var(--gap) * 2) calc(env(safe-area-inset-left) + var(--gap)); }

#grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gap); }
.tile { all: unset; cursor: pointer; display: block; min-width: 0; }
.tile .img { aspect-ratio: 1; border-radius: 10px; overflow: hidden; position: relative; background: #1b1b22;
  outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.2em; font-weight: 700; color: #fff9; }
.tile .name { margin-top: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.active .img { outline-color: var(--accent); }
.tile.active .name { color: var(--accent); }
.tile:active .img { transform: scale(.97); }

#sentinel { height: 1px; }
#empty { text-align: center; color: var(--muted); margin-top: 30vh; }

#player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 10px) calc(env(safe-area-inset-left) + 12px);
  min-height: calc(var(--footer-h) + env(safe-area-inset-bottom));
  background: rgba(24, 24, 30, .88); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid #ffffff14; }
#player .cover { width: 48px; height: 48px; border-radius: 6px; flex: none; background: #26262f center/cover no-repeat; }
#player .meta { flex: 1; min-width: 0; }
#title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#status { font-size: 12px; color: var(--muted); height: 1.3em; }
.controls { display: flex; align-items: center; gap: 2px; flex: none; }
.controls button { all: unset; cursor: pointer; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; }
.controls button:active { background: #ffffff1f; }
.controls svg { width: 24px; height: 24px; fill: var(--fg); }
.controls button.main { background: var(--fg); margin: 0 4px; }
.controls button.main svg { fill: #000; }
.controls button[hidden], svg[hidden] { display: none; }
@media (max-width: 380px) { .controls button { width: 38px; height: 38px; } #player .cover { display: none; } }

/* login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 0; }
body.login main { text-align: center; }
body.login h1 { font-size: 34px; margin: 0 0 28px; }
body.login .g_id_signin { display: flex; justify-content: center; }
#err { color: #ff6b6b; margin-top: 20px; }

/* офлайн */
#sync { position: fixed; top: calc(env(safe-area-inset-top) + 6px); right: calc(env(safe-area-inset-right) + 8px); z-index: 20;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; color: var(--muted); pointer-events: none;
  background: rgba(24, 24, 30, .92); border: 1px solid #ffffff14; max-width: 80vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sync[hidden] { display: none; }
.tile.nocache { opacity: .35; }
