/* Оформление приложения «Люся Может!» */
:root {
  color-scheme: light dark;
  --ink: #2b2f3a;
  --bg: #f6f6f7;
  --text: #24262c;
  --muted: #6f7380;
  --border: #e4e5e9;
  --surface: #ffffff;
  --link: #4a5578;
  --primary: #4a5578;
  --danger: #a8505a;
  --dark: #5a5e6b;
  --ok: #1a7f43;
  --warn-bg: #fff3cd;
  --warn-text: #664d03;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #1e2027;
    --bg: #17181d;
    --text: #e3e4e8;
    --muted: #9599a6;
    --border: #2f323b;
    --surface: #1f2128;
    --link: #a7b1d0;
    --primary: #5a6690;
    --danger: #a8505a;
    --dark: #4a4e5a;
    --ok: #4cc98a;
    --warn-bg: #3d3210;
    --warn-text: #f5dc8f;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; }
h1, h2, h3, h4, h5 { margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.2rem; }
h5 { font-size: 1.05rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
[hidden] { display: none !important; }

.page { display: flex; flex-direction: column; min-height: 100dvh; }
main { flex: 1; min-width: 0; }
.content { padding: 1.1rem 1rem 3rem; max-width: 1100px; }

.sidebar {
  background: var(--ink);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
.top-row {
  display: flex;
  align-items: center;
  gap: .25rem;
  min-height: 3.5rem;
  padding: 0 .75rem;
}
.brand { color: #fff; font-size: 1.1rem; font-weight: 600; margin-right: auto; }
.brand:hover { text-decoration: none; }
.nav { display: none; flex-direction: column; gap: .25rem; padding: .75rem; }
.nav.open { display: flex; }
.nav a, .nav-action {
  display: block;
  width: 100%;
  padding: .7rem .75rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #c6c8d0;
  font: inherit;
  font-size: .95rem;
  text-align: left;
  cursor: pointer;
}
.nav a:hover, .nav-action:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.nav a.active, .nav a.active:hover { background: rgba(255, 255, 255, .14); color: #fff; }

@media (min-width: 641px) {
  .page { flex-direction: row; }
  .sidebar {
    flex: 0 0 250px;
    height: 100dvh;
    position: sticky;
    top: 0;
    overflow-y: auto;
  }
  .nav { display: flex; }
  .top-row .menu-btn { display: none; }
  .content { padding: 1.1rem 1.5rem 3rem 2rem; }
}

.icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(127, 127, 127, .18); }
.icon-btn:disabled { opacity: .5; cursor: progress; }
.icon-btn.busy .icon { animation: pulse 1s ease-in-out infinite; }
.nav-btn { color: #fff; }

.btn {
  display: inline-block;
  padding: .5rem .9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.btn:hover { filter: brightness(.95); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
:focus-visible { outline: 3px solid #258cfb; outline-offset: 1px; }

.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.mt { margin-top: .75rem; }
.mb { margin-bottom: .75rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.lead { font-size: 1.2rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.toolbar .control { flex: 1 1 14rem; width: auto; }

/* border-collapse: collapse не даёт скруглять углы */
.table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr > :first-child { padding-left: .9rem; }
.table tr > :last-child { padding-right: .9rem; }
@media (min-width: 641px) {
  .table tr > :first-child { padding-left: 1.5rem; }
  .table tr > :last-child { padding-right: 1.5rem; }
}
.table th { color: var(--muted); font-weight: 400; font-size: .85rem; text-align: left; }
.table th, .table td { padding: .55rem .4rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.song-cell { display: flex; flex-wrap: wrap; gap: 0 .75rem; }
.song-cell .artist, .song-cell .song-name { flex: 1 1 11rem; min-width: 0; overflow-wrap: anywhere; }
.song-name { font-weight: 700; color: inherit; }
.flags { width: 1.5rem; padding-inline: .1rem; color: var(--muted); }

.card { border: 1px solid var(--border); border-radius: 14px; margin: 0 0 1rem; overflow: hidden; background: var(--surface); }
.card-header { margin: 0; padding: .7rem 1rem; border-bottom: 1px solid var(--border); font-size: 1.05rem; font-weight: 700; }
.card-body { padding: 1rem; }

.minus-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.minus-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.75rem; border-top: 1px solid var(--border); }
.row-actions { display: inline-flex; align-items: center; flex: none; }
.saved { color: var(--ok); }
.player { width: 100%; margin-top: .75rem; }

.form { max-width: 600px; margin-bottom: 1.25rem; }
.field { display: block; margin-bottom: .75rem; }
.field > span { display: block; margin-bottom: .2rem; }
.control {
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.check { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.check input { width: 1.1rem; height: 1.1rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 1rem; margin-top: .5rem; }

.set-head { display: flex; flex-wrap: wrap; gap: 0 1rem; font-size: 1.4rem; margin-bottom: 1rem; }
.set-num { margin: 1rem 0 .5rem 2rem; font-weight: 700; }
.set-songs { font-size: 1.15rem; margin: 0; padding-left: 2rem; }
.set-songs li { padding: .25rem 0; }
.set-songs a { color: inherit; }
.offline-panel { margin-top: 2rem; max-width: 600px; }
.progress { width: 100%; margin-top: .5rem; }

.edit-list { padding-left: 1.75rem; max-width: 600px; }
.edit-list li { padding: .1rem 0; }
.edit-list li > * { vertical-align: middle; }
.edit-list .row-actions { float: right; }
.edit-list li::after { content: ""; display: block; clear: both; }
.add-list { list-style: none; margin: .5rem 0 0; padding: 0; max-width: 600px; }
.add-list li { display: flex; align-items: center; gap: .25rem; }

.notice { padding: .9rem 1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); margin-top: .75rem; }
.notice p { margin: 0 0 .6rem; }
.notice-error { border-color: var(--danger); }
.banner { padding: .55rem 1rem; background: var(--warn-bg); color: var(--warn-text); font-size: .95rem; }
.banner-update .btn { margin-left: .5rem; padding: .2rem .7rem; }

.spinner { width: 2.5rem; height: 2.5rem; margin: 3rem auto; border: .25rem solid var(--primary); border-right-color: transparent; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  .icon-btn.busy .icon { animation: none; }
}

#toasts { position: fixed; left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 20; display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; }
.toast { max-width: 32rem; padding: .6rem 1rem; border-radius: 6px; background: var(--ok); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.toast-ok { background: #1a7f43; }
.toast-error { background: var(--danger); }

.dialog { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); max-width: 26rem; }
.dialog p { margin-top: 0; }
.dialog::backdrop { background: rgba(0, 0, 0, .45); }

@media print {
  .sidebar, .offline-panel, .banner { display: none !important; }
}
