* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #14161c;
  color: #e6e6e6;
  padding-bottom: 70px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
#app-header {
  width: 100%; max-width: 640px;
  margin: 0 auto;
  z-index: 20;
  background: #1d2029;
  flex-shrink: 0;
}
header {
  padding: 16px 20px 0;
  border-bottom: 1px solid #2a2e3a;
}
header h1 { margin: 0 0 10px; font-size: 20px; }
nav { display: flex; gap: 8px; }
.tab {
  background: #2a2e3a;
  color: #cfd2da;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.tab.active { background: #4f7cff; color: #fff; }
.tab-name { font-weight: 600; }
.tab-size { font-size: 11px; opacity: 0.8; margin-left: 2px; font-variant-numeric: tabular-nums; }
.tab.active .tab-size { opacity: 0.95; }

.toolbar { display: flex; gap: 8px; margin-top: 10px; }
.btn {
  background: #2a2e3a;
  color: #cfd2da;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: #3a3f4f; }
.btn.active { background: #4f7cff; color: #fff; }
.btn.danger { background: #7a2b2b; }
.btn.danger:hover { background: #9a3535; }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 20px;
  overflow-y: auto;
  flex: 1;
  width: 100%;
}
.player-bar {
  background: #14161c;
  padding: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
}
#player { width: 100%; }
#search {
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #2a2e3a;
  background: #1d2029;
  color: #e6e6e6;
  font-size: 14px;
}
#search::placeholder { color: #888; }
#now-playing { margin-top: 8px; color: #9aa0ad; font-size: 14px; cursor: pointer; }
.controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.controls button {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #2a2e3a;
  color: #fff;
  border: none;
  padding: 10px 6px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.controls button:hover { background: #3a3f4f; }
.controls button.active { background: #4f7cff; color: #fff; box-shadow: inset 0 0 0 2px #fff, 0 0 12px rgba(79,124,255,0.9); }
#btn-shuffle { background: transparent; border: 1px solid #3a3f4f; }
#btn-shuffle.active { background: #4f7cff; border-color: #fff; color: #fff; box-shadow: 0 0 12px rgba(79,124,255,0.9); }
#list { list-style: none; padding: 0; margin: 16px 0 0; }

.track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1d2029;
  margin-bottom: 8px;
  overflow: hidden;
}
.track > * { position: relative; z-index: 1; }
.track .check {
  flex: 0 0 auto;
  font-size: 20px;
  cursor: pointer;
  user-select: none;
}
.track .name {
  flex: 1 1 auto;
  min-width: 0;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track .dur {
  flex: 0 0 auto;
  color: #888;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.track .actions { display: flex; gap: 6px; flex: 0 0 auto; }
.track .act {
  background: #2a2e3a;
  border: none;
  color: #fff;
  font-size: 16px;
  width: 34px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
}
.track .act:hover { background: #3a3f4f; }
.track .btn-dislike {
  background: transparent !important;
  border: none;
  color: #888;
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.track .btn-dislike:hover { background: #3a3f4f !important; color: #e74c3c; }
.now-actions { display: flex; gap: 10px; margin: 2px 0 0; width: 100%; }
.now-actions .act {
  background: #2a2e3a;
  border: none;
  color: #fff;
  font-size: 20px;
  flex: 1 1 0;
  width: auto;
  height: 46px;
  border-radius: 8px;
  cursor: pointer;
}
.now-actions .act:hover { background: #3a3f4f; }
.now-actions .act:disabled { opacity: .4; cursor: default; }
.track.playing { background: #11131a; cursor: ew-resize; user-select: none; touch-action: pan-y; }
.track.playing .name { color: #fff; font-weight: 600; }
.track-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: rgba(79,124,255,0.30);
  border-radius: 8px;
  z-index: 0;
  transition: width 0.2s linear;
}

.selection-bar {
  position: fixed;
  left: 50%; transform: translateX(-50%); width: 100%; max-width: 640px; bottom: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #1d2029;
  border-top: 1px solid #2a2e3a;
}
#sel-count { flex: 1 1 auto; font-size: 14px; }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20,22,28,0.85);
  border: 3px dashed #4f7cff;
  color: #fff;
  font-size: 18px;
  text-align: center;
  padding: 20px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 60;
  display: none;
  font-size: 14px;
  max-width: 90%;
  text-align: center;
}
.empty { color: #777; text-align: center; margin-top: 40px; }

/* Увеличиваем строки и кнопки ~на 20% на смартфонах (тап-цели удобнее) */
@media (max-width: 640px) {
  .track {
    padding: 12px 14px;
    gap: 10px;
    margin-bottom: 10px;
  }
  .track .name { font-size: 16px; }
  .track .dur { font-size: 13px; }
  .track .act {
    width: 41px;
    height: 39px;
    font-size: 19px;
    border-radius: 7px;
  }
  .track .btn-dislike {
    width: 32px;
    height: 32px;
    font-size: 16px;
    background: #2a2e3a !important;
    color: #ccc !important;
  }
  .track .check { font-size: 24px; }
  .controls button { padding: 12px 6px; font-size: 15px; }
  nav { display: flex; gap: 6px; }
  .tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 4px;
    min-height: 66px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.2;
  }
  .tab-name { display: block; }
  .tab-size { display: block; font-size: 10px; margin-top: 3px; }
}
@media (max-width: 640px) {
  .now-actions { width: 100%; }
  .now-actions .act { flex: 1 1 0; width: auto; height: 52px; font-size: 22px; }
}
