:root{
  --bg:#ffffff;
  --soft:#f6f6f6;
  --text:#101010;
  --muted:#6a6a6a;
  --yellow:#ffd84d;
  --yellow2:#ffe36b;
  --border:#111;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --r:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background: var(--soft);
  color: var(--text);
}

.hidden{display:none}

.app{
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 140px; /* player + bottom nav */
}

.topbar{
  position: sticky;
  top:0;
  z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,.08);
  padding: 12px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.brand{display:flex;gap:10px;align-items:center}
.dot{
  width:12px;height:12px;border-radius:999px;
  background: var(--yellow);
  border:2px solid var(--border);
}
.brandTitle{font-weight:900;letter-spacing:.2px}
.brandSub{font-size:12px;color:var(--muted)}

.screen{padding:12px}

.card{
  background: var(--bg);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
}

.loginCard h1{margin:0 0 8px 0}
.field{display:block;margin-top:12px}
.field span{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
input{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.12);
  padding: 12px 12px;
  font-size: 16px;
  outline: none;
}
input:focus{border-color: rgba(0,0,0,.35)}

.primaryBtn{
  width:100%;
  margin-top: 14px;
  border:2px solid var(--border);
  background: var(--yellow);
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 900;
  font-size: 16px;
  cursor:pointer;
}

.error{
  margin-top:10px;
  background:#ffe5e5;
  border:1px solid #ffb4b4;
  padding:10px;
  border-radius:12px;
  color:#7a0b0b;
}

.sectionTitle{
  font-weight: 900;
  font-size: 14px;
  margin: 10px 4px;
  color: rgba(0,0,0,.75);
}

.promoRow{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.promoCard{
  background: var(--bg);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
  display:flex;
  gap: 10px;
  align-items:center;
  cursor:pointer;
}
.promoIcon{font-size:26px}
.promoTitle{font-weight:900}
.promoSub{font-size:12px;color:var(--muted)}

.hScroll{
  display:flex;
  gap: 12px;
  overflow:auto;
  padding: 4px 2px 6px 2px;
}
.hScroll::-webkit-scrollbar{height:0}

.albumChip{
  min-width: 140px;
  background: var(--bg);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow:hidden;
  cursor:pointer;
}
.albumChip img{width:100%;aspect-ratio:1/1;object-fit:cover;display:block}
.albumChip .cap{padding:10px}
.albumChip .name{font-weight:900;font-size:13px;line-height:1.1}
.albumChip .sub{font-size:12px;color:var(--muted);margin-top:4px}

.searchRow{
  display:flex;gap:10px;align-items:center;
  margin-bottom: 10px;
}
.grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 420px){
  .grid{grid-template-columns: repeat(3, 1fr);}
}

.albumCard{
  background: var(--bg);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow:hidden;
  cursor:pointer;
}
.albumCard img{width:100%;aspect-ratio:1/1;object-fit:cover;display:block}
.albumCard .cap{padding:10px}
.albumCard .name{font-weight:900;font-size:13px;line-height:1.1}
.albumCard .sub{font-size:12px;color:var(--muted);margin-top:4px}

.backBtn{
  border:none;
  background:transparent;
  font-weight:900;
  padding: 10px 4px;
  cursor:pointer;
  color: rgba(0,0,0,.7);
}

.albumHero{
  position: relative;
  border-radius: 26px;
  overflow:hidden;
  box-shadow: var(--shadow);
}
.cover{
  width:100%;
  display:block;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: #eee;
}
.playBig{
  position:absolute;
  right: 16px;
  bottom: 16px;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border:2px solid var(--border);
  background: var(--yellow);
  font-size: 22px;
  font-weight: 900;
  cursor:pointer;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}

.albumMeta{padding: 12px 4px}
.albumTitle{font-weight: 1000; font-size: 22px; line-height: 1.1}
.albumArtist{margin-top:6px}
.metaActions{display:flex;gap:10px;margin-top:12px}

.pill{
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 900;
  cursor:pointer;
}

.trackList{
  margin-top: 6px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.trackRow{
  display:flex;
  gap:10px;
  align-items:center;
  padding: 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.trackRow:last-child{border-bottom:none}
.trackNum{width:26px;color:var(--muted);font-weight:800}
.trackName{flex:1;font-weight:900}
.trackRight{display:flex;gap:10px;align-items:center}
.smallBtn{
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight:900;
}

.iconBtn{
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  border-radius: 14px;
  padding: 10px 12px;
  cursor:pointer;
  font-weight:900;
}

.row{display:flex;gap:10px;align-items:center}
.between{justify-content:space-between}
.rowTitle{font-weight:1000}

.list{margin-top:10px}
.listItem{
  padding: 12px;
  border-radius: 14px;
  border:1px solid rgba(0,0,0,.08);
  background:#fff;
  margin-bottom:10px;
  cursor:pointer;
}
.listItem .t{font-weight:1000}
.listItem .s{color:var(--muted);font-size:12px;margin-top:4px}

/* player */
.player{
  position: fixed;
  left:0; right:0;
  bottom: 58px; /* above bottom nav */
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,.08);
  padding: 10px 10px;
  z-index: 30;
}
.playerRow{
  max-width: 520px;
  margin: 0 auto;
  display:flex;
  align-items:center;
  gap: 10px;
}
.miniCover{
  width:44px;height:44px;border-radius: 14px;
  object-fit:cover;
  border:1px solid rgba(0,0,0,.08);
}
.now{flex:1;min-width:0}
.nowTitle{
  font-weight: 1000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nowSub{
  font-size:12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#seek{width:100%;margin-top:8px}

/* bottom nav */
.bottomNav{
  position: fixed;
  left:0; right:0; bottom:0;
  background: rgba(255,255,255,.98);
  border-top: 1px solid rgba(0,0,0,.08);
  z-index: 40;
  padding: 10px 10px 14px 10px;
}
.bottomNav{
  display:flex;
  justify-content:space-around;
  gap: 10px;
}
.navBtn{
  flex:1;
  border:1px solid rgba(0,0,0,.10);
  background:#fff;
  border-radius: 16px;
  padding: 12px 10px;
  font-weight: 1000;
  cursor:pointer;
}
.navBtn.active{
  border: 2px solid var(--border);
  background: var(--yellow2);
}

/* toast */
.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 150px;
  background: rgba(0,0,0,.82);
  color:#fff;
  padding: 10px 12px;
  border-radius: 14px;
  z-index: 100;
  max-width: 90%;
  text-align:center;
}

/* modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  z-index: 120;
}
.modalCard{
  width: 100%;
  max-width: 520px;
  background:#fff;
  border-radius: 22px 22px 0 0;
  padding: 14px;
  box-shadow: var(--shadow);
}

/* ===== AUTH SAFE MODE ===== */
body.not-auth .player,
body.not-auth .bottomNav,
body.not-auth .modal {
  display: none !important;
}

/* ================= HARD MODAL BLOCK ================= */

/* пока не авторизованы — модалка не существует */
body.not-auth #modal {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* hidden = реально скрыто */
#modal.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* только когда modal БЕЗ hidden — показываем */
#modal:not(.hidden) {
  display: flex;
}

