/* ===================================================
   SongBase.pro — главный стиль
   =================================================== */

/* --- Переменные --- */
:root {
  --primary:       #4f46e5;
  --primary-dark:  #3730a3;
  --primary-light: #e0e7ff;
  --chord-color:   #1d4ed8;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --border-focus:  #a5b4fc;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  --shadow-hover:  0 4px 20px rgba(79,70,229,.14);
  --header-h:      60px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* iOS Safari автоматически увеличивает текст при ротации — отключаем */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* --- Layout --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Header --- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.site-logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -.02em;
}
.site-logo:hover { color: var(--primary-dark); }
.site-logo svg { flex-shrink: 0; }
.site-nav { display: flex; gap: .25rem; }
.nav-link {
  padding: .35rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* --- Main / Footer --- */
.site-main { flex: 1; padding: 2rem 0 3rem; }
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
.footer-copy { font-size: .85rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 1rem; }
.footer-link { font-size: .85rem; color: var(--text-muted); text-decoration: none; }
.footer-link:hover { color: var(--primary); }
.footer-link--admin {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  opacity: .55;
  transition: opacity .2s, color .2s;
}
.footer-link--admin:hover { opacity: 1; color: var(--primary); }

/* ===================================================
   Главная страница
   =================================================== */

.page-hero {
  text-align: center;
  margin-bottom: 2rem;
}
.page-hero-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
  margin-bottom: .4rem;
}
.page-hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* --- Поиск --- */
.search-wrap {
  position: relative;
  margin-bottom: 1.5rem;
}
.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}
.search-input {
  width: 100%;
  padding: .8rem 1rem .8rem 2.75rem;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

/* --- Выпадающий список результатов поиска (страница песни) --- */
.song-search-results {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  max-height: 340px;
  overflow-y: auto;
  z-index: 20;
}
.song-search-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
}
.song-search-item a:hover,
.song-search-item a:focus { background: var(--surface-2); }
.song-search-title {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-search-artist {
  font-size: .8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.song-search-empty {
  padding: .7rem .75rem;
  color: var(--text-muted);
  font-size: .875rem;
  text-align: center;
}

/* --- Счётчик --- */
.song-count {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* --- Список песен --- */
.song-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.song-item {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.song-item .song-card { flex: 1; min-width: 0; }

.song-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.1rem;
  background: var(--surface);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  border: 1px solid transparent;
}
.song-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  border-color: var(--primary-light);
}
.song-info { min-width: 0; }
.song-title-text {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-artist-text {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: .1rem;
}
.key-badge {
  flex-shrink: 0;
  margin-left: .75rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: .15rem .7rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
}

/* --- Пустой результат --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: .75rem; opacity: .4; }
.empty-state p { font-size: 1.05rem; margin-bottom: 1rem; }

/* --- Пагинация --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: 1.75rem;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 .5rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.page-link:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-link--current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: default;
}
.page-link--current:hover { background: var(--primary); color: #fff; }
.page-link--arrow { font-size: 1.1rem; }
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 2.25rem;
  color: var(--text-muted);
}

/* ===================================================
   Страница песни
   =================================================== */

.song-page { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; overflow-x: hidden; }

/* --- Хлебные крошки --- */
.breadcrumb {
  margin-bottom: 1.25rem;
  font-size: .875rem;
}
.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.breadcrumb a:hover { color: var(--primary); }

/* --- Заголовок песни --- */
.song-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.song-heading-main { min-width: 0; }
.song-heading-admin {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-shrink: 0;
  padding-top: .25rem;
}
.song-heading-title {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.2;
}
.song-heading-artist {
  margin-top: .35rem;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* --- Панель транспонирования --- */
.transpose-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.1rem;
  margin-bottom: 1.5rem;
}
.transpose-label {
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 500;
}
.t-controls {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.t-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
}
.t-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.t-key-display {
  min-width: 3rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}
.key-select {
  padding: .4rem .7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
}
.key-select:focus { border-color: var(--primary); }
.btn-reset {
  padding: .35rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-reset:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}
/* Разделитель между группами контролов */
.t-sep {
  width: 1px;
  height: 1.5rem;
  background: var(--border);
  flex-shrink: 0;
  align-self: center;
}

/* Кнопки A− / A+ (изменение шрифта) */
.t-btn-font {
  width: auto;
  min-width: 38px;
  padding: 0 .55rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  letter-spacing: .01em;
  touch-action: manipulation; /* предотвращает задержку двойного тапа на iOS */
}
.t-btn-font:disabled {
  opacity: .3;
  cursor: not-allowed;
}
.t-btn-font:disabled:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Кнопка «Поделиться» — только мобильная версия (на десктопе URL и так виден в адресной строке) */
.t-sep--share, .t-btn-share { display: none; }
@media (max-width: 640px) {
  .t-sep--share, .t-btn-share { display: flex; }
}

.btn-copy {
  margin-left: auto;
  padding: .35rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-copy:hover { background: var(--surface-2); color: var(--primary); }

/* --- Кнопка добавления в сборник --- */
.t-btn-coll { color: var(--text-muted); }
.t-btn-coll:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.t-btn-coll--in  { color: var(--primary); border-color: var(--primary); }
.t-btn-coll--in svg { fill: var(--primary); }
.t-btn-coll--in:hover { background: var(--primary); color: #fff; }
.t-btn-coll--in:hover svg { fill: #fff; }
.coll-select { max-width: 160px; }

/* Toast-уведомление сборников */
.coll-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(.75rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem 1.1rem;
  font-size: .875rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.14);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  transition: opacity .2s, transform .2s;
}
.coll-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }
.coll-toast--ok  { color: #166534; border-color: #86efac; background: #f0fdf4; }
.coll-toast--err { color: #991b1b; border-color: #fca5a5; background: #fef2f2; }
[data-theme="dark"] .coll-toast--ok  { color: #86efac; border-color: #166534; background: rgba(5,46,22,.85); }
[data-theme="dark"] .coll-toast--err { color: #fca5a5; border-color: #991b1b; background: rgba(45,10,10,.85); }

/* --- Страница «Мои сборники» --- */
.colls-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.coll-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.coll-block-head {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .5rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.coll-block-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coll-block-count {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.coll-block-del { margin-left: auto; }
.coll-rename-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 5px;
  border-radius: var(--radius-sm);
  line-height: 0;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.coll-block-head:hover .coll-rename-btn { opacity: 1; }
.coll-rename-btn:hover { color: var(--primary); }
.coll-rename-input {
  flex: 1;
  min-width: 60px;
  font-weight: 700;
  font-size: 1rem;
  border: 1.5px solid var(--border-focus);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.coll-block-empty {
  padding: .75rem 1rem;
  color: var(--text-muted);
  font-size: .875rem;
  margin: 0;
}
.coll-block-songs {
  list-style: none;
  margin: 0;
  padding: 0;
}
.coll-block-song {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem;
  border-top: 1px solid var(--border);
  list-style: none;
}
.coll-block-song:first-child { border-top: none; }
.coll-song-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
}
.coll-song-title {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
.coll-song-title:hover { color: var(--primary); text-decoration: underline; }
.coll-song-artist {
  font-size: .8rem;
  color: var(--text-muted);
}
.coll-song-rm { flex-shrink: 0; }
.coll-rm-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .85rem;
  padding: .2rem .35rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color .15s, background .15s;
}
.coll-rm-btn:hover { color: #ef4444; background: rgba(239,68,68,.1); }

/* --- Drag handles --- */
.drag-handle {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: grab;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  opacity: .45;
  transition: opacity .15s;
  user-select: none;
  touch-action: none;
}
.drag-handle:hover { opacity: 1; }
.drag-handle--coll  { margin-right: 6px; }
.drag-handle--song  { margin-right: 8px; }
.drag-placeholder {
  box-sizing: border-box;
  list-style: none;
  background: var(--accent);
  opacity: .15;
  border-radius: var(--radius);
}

/* --- Текст с аккордами --- */
.lyrics-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#song-lyrics-root { display: block; }

/* Ряд с аккордами */
.ly-row {
  display: flex;
  flex-wrap: nowrap;
  line-height: 1;
  margin-bottom: .05rem;
  white-space: pre;
}
.ly-seg {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}
/* Неразрывный блок «слово (+аккорды внутри него)» — единица переноса строки */
.ly-word {
  display: inline-flex;
  flex-wrap: nowrap;
}
.ly-chord {
  font-family: 'Courier New', Courier, monospace;
  font-size: .8em;          /* 80% от базового размера #song-lyrics-root */
  font-weight: 700;
  color: var(--chord-color);
  line-height: 1.5;
  min-height: 1.5em;        /* не даёт строке схлопнуться в 0, когда аккорда нет (пустой плейсхолдер) */
  white-space: pre;
  min-width: .5ch;
  padding-right: .25ch;
}
.ly-txt {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1em;           /* наследует от #song-lyrics-root */
  line-height: 1.75;
  white-space: pre;
  color: var(--text);
}

/* Строка без аккордов */
.ly-plain {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1em;           /* наследует от #song-lyrics-root */
  line-height: 1.75;
  color: var(--text-muted);
  font-style: italic;
  white-space: pre-wrap;
}
/* Пустая строка-разделитель */
.ly-empty { height: 1rem; }

/* На мобиле шрифт управляется через --lyrics-font-size (кнопки А−/А+) */

/* ===================================================
   Кнопки / общие элементы
   =================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
  border: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1.5px solid #fca5a5;
}
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ===================================================
   Админка
   =================================================== */

.admin-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .5rem 0;
}
.admin-nav .container {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
}
.admin-nav-link {
  padding: .35rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.admin-nav-link:hover, .admin-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Карточки статистики */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.03em;
  line-height: 1;
}
.stat-label {
  margin-top: .35rem;
  font-size: .875rem;
  color: var(--text-muted);
}

/* Таблица --- */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.admin-table th {
  background: var(--surface-2);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface-2); }
.td-actions { display: flex; gap: .4rem; align-items: center; white-space: nowrap; }

/* Форма --- */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  max-width: 780px;
}
.form-grid {
  display: grid;
  gap: 1.2rem;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
@media (max-width: 520px) { .form-row-2 { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}
.form-help { font-size: .78rem; color: var(--text-muted); }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-textarea {
  font-family: 'Courier New', Courier, monospace;
  font-size: .9rem;
  resize: vertical;
  min-height: 320px;
  line-height: 1.6;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

/* Превью текста --- */
.preview-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .5rem;
}
.preview-box {
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  min-height: 120px;
  overflow-x: auto;
  font-size: .9rem;
}

/* Уведомления --- */
.alert {
  padding: .75rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Страница логина --- */
.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - var(--header-h) - 80px);
  padding: 2rem 1rem;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}
.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.025em;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Страница подтверждения удаления */
.confirm-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 480px;
}
.confirm-title { font-size: 1.15rem; font-weight: 700; margin-bottom: .75rem; }
.confirm-actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* Заголовок раздела --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.025em;
}

/* ===================================================
   Редактор с разделённым экраном
   =================================================== */

/* Широкий контейнер для страниц редактора */
.container-wide {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Мета-поля сверху (название / исполнитель / тональность) */
.editor-meta {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.4rem;
  margin-bottom: .75rem;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 200px;
  gap: 1rem;
  align-items: start;
}

/* Сам split */
.editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  align-items: start;
  margin-bottom: .75rem;
}

/* Левая панель — предпросмотр */
.editor-preview-pane {
  position: sticky;
  top: calc(var(--header-h) + .75rem);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
  max-height: calc(100vh - var(--header-h) - 1.5rem);
  overflow-y: auto;
  overflow-x: auto;
}
.editor-preview-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .9rem;
}
.editor-preview-song-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.3;
  min-height: 1.5em;
  word-break: break-word;
}
.editor-preview-song-artist {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: .2rem;
  margin-bottom: .85rem;
  min-height: 1.2em;
}
/* Скрываем лишние тени/фон у lyrics-wrap внутри превью */
.editor-preview-pane .lyrics-wrap {
  box-shadow: none;
  padding: 0;
  background: transparent;
  border-top: 1px solid var(--border);
  padding-top: .85rem;
  margin-top: .1rem;
}

/* Правая панель — редактор */
.editor-input-pane {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
/* Textarea растягивается на всю доступную высоту */
.editor-textarea {
  min-height: calc(100vh - var(--header-h) - 260px);
  resize: vertical;
}

/* Панель кнопок снизу */
.editor-actions {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem 1.4rem;
  display: flex;
  gap: .65rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ===================================================
   Адаптивность
   =================================================== */

@media (max-width: 900px) {
  .editor-split { grid-template-columns: 1fr; }
  .editor-preview-pane {
    position: static;
    max-height: 55vh;
    order: 2;
  }
  .editor-input-pane { order: 1; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .site-main { padding: 1.25rem 0 2.5rem; }
  .transpose-bar { gap: .5rem; }
  .btn-copy { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .editor-textarea { min-height: 300px; }

  /* Lyrics: wrap instead of horizontal scroll on mobile */
  .ly-row  { flex-wrap: wrap; white-space: normal; }
  .ly-chord { white-space: nowrap; }          /* chord names never break */
  .ly-txt  { white-space: pre-wrap; word-break: break-word; }
  .ly-seg  { max-width: 100%; }
  .ly-word { max-width: 100%; }               /* wrap happens between words, never inside one */
  .lyrics-wrap { overflow-x: visible; }      /* no inner scroll when wrapped */

  /* Collections tab: bigger touch targets + cleaner layout */
  .drag-handle { padding: 14px 17px; opacity: .65; }
  .coll-block-count { display: none; }
  .coll-block-song { gap: .5rem; padding: .5rem .75rem; }
  .coll-rm-btn { padding: .45rem .55rem; font-size: 1rem; }
  .coll-rename-btn { opacity: .6; padding: 10px; }
  .coll-song-artist { display: none; }
  .coll-song-info { flex-wrap: nowrap; overflow: hidden; }
  .coll-song-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

  /* Admin-таблицы: строки превращаются в карточки вместо горизонтального скролла */
  .admin-table-wrap { overflow-x: visible; }
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table { background: none; box-shadow: none; }
  .admin-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: .2rem .9rem;
    margin-bottom: .6rem;
  }
  .admin-table tr:last-child { margin-bottom: 0; }
  .admin-table tr:hover td { background: none; }
  .admin-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .5rem 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
  }
  .admin-table td:last-of-type { border-bottom: none; }
  .admin-table td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
  }
  .admin-table td[colspan] {
    text-align: center;
    justify-content: center;
  }
  .admin-table td.td-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    border-bottom: none;
  }

  /* Diff-просмотр правок: колонки друг под другом вместо бок о бок.
     !important нужен, т.к. база .diff-wrap объявлена ниже по каскаду (строка ~1810) */
  .diff-wrap { grid-template-columns: 1fr !important; }
  .diff-col-l { border-right: none !important; border-bottom: 1px solid var(--border); }

  /* Модалки admin/songs.php — уже теснее на маленьких экранах */
  #reject-modal > div,
  #edit-review-modal > div {
    padding: 1.1rem !important;
    margin: .5rem !important;
    max-width: calc(100% - 1rem) !important;
  }
}

@media (max-width: 400px) {
  .page-hero { margin-bottom: 1.25rem; }
  .form-card { padding: 1.25rem; }
  .login-card { padding: 1.75rem 1.25rem; }
}

/* ===================================================
   Ночная тема
   =================================================== */

[data-theme="dark"] {
  --primary:       #818cf8;
  --primary-dark:  #6366f1;
  --primary-light: #1e1b4b;
  --chord-color:   #93c5fd;
  --bg:            #0f172a;
  --surface:       #1e293b;
  --surface-2:     #273549;
  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --border:        #334155;
  --border-focus:  #818cf8;
  --shadow:        0 1px 4px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.4);
  --shadow-hover:  0 4px 20px rgba(129,140,248,.25);
  color-scheme: dark;   /* скроллбары и нативные контролы тоже тёмные */
}

/* Хардкодные цвета, не переопределяемые переменными */
[data-theme="dark"] .alert-success {
  background: #052e16; color: #86efac; border-color: #166534;
}
[data-theme="dark"] .alert-error {
  background: #2d0a0a; color: #fca5a5; border-color: #7f1d1d;
}
[data-theme="dark"] .alert-info {
  background: #0c1a2e; color: #93c5fd; border-color: #1e3a5f;
}
[data-theme="dark"] .diff-del { background:rgba(239,68,68,.2);  color:#fca5a5; }
[data-theme="dark"] .diff-add { background:rgba(34,197,94,.18); color:#86efac; }
[data-theme="dark"] .diff-ph  { background:rgba(255,255,255,.03); }
[data-theme="dark"] .btn-danger {
  background: #3b0a0a; color: #fca5a5; border-color: #7f1d1d;
}
[data-theme="dark"] .btn-danger:hover { background: #4c0d0d; }

/* Плавное переключение только у элементов, у которых нет своего transition */
body,
.site-header,
.site-footer,
.lyrics-wrap,
.key-badge,
.transpose-bar,
.stat-card,
.admin-nav,
.editor-meta,
.editor-preview-pane,
.editor-input-pane,
.editor-actions,
.login-card,
.confirm-card {
  transition: background-color .25s ease, color .2s ease, border-color .2s ease;
}

/* ─── Кнопка тёмной темы в подвале ─── */
.btn-theme {
  background: none;
  border: none;
  cursor: pointer;
  padding: .15rem .25rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  opacity: .55;
  transition: opacity .2s, color .2s;
  line-height: 1;
}
.btn-theme:hover { opacity: 1; color: var(--primary); }

/* Луна — видна в светлой теме, прячется в тёмной */
.icon-moon { display: block; }
.icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: block; }

/* ─── Стили печати ─── */
@media print {
  /* Скрываем всё лишнее */
  .site-header,
  .site-footer,
  .breadcrumb,
  .song-search-wrap,
  .transpose-bar,
  .song-heading-admin,
  .btn-copy { display: none !important; }

  /* Базовое оформление страницы */
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  .song-page {
    max-width: 100%;
    padding: 0;
  }

  /* Заголовок */
  .song-heading {
    margin-bottom: .75rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: .5rem;
  }
  .song-heading-title { font-size: 16pt; color: #000; }
  .song-heading-artist { font-size: 12pt; color: #444; }

  /* Текст с аккордами */
  .lyrics-wrap {
    overflow: visible !important;
  }
  #song-lyrics-root {
    font-size: 10pt !important;
  }
  .ly-chord {
    color: #1a3a8f;       /* тёмно-синий — хорошо читается на ч/б */
    font-weight: 700;
  }
  .ly-txt, .ly-plain {
    color: #000;
  }

  /* Не разрывать строку между аккордом и текстом */
  .ly-row    { break-inside: avoid; page-break-inside: avoid; }
  .ly-block  { break-inside: avoid; page-break-inside: avoid; }

  /* Убрать тени и декор */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }
  a { color: inherit; text-decoration: none; }
}

/* ═══════════════════════════════════════════════════════════
   Страница настроек администратора
   ═══════════════════════════════════════════════════════════ */

/* ─── Вкладки ────────────────────────────────────────────── */
.s-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.s-tab {
  padding: .45rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.s-tab:hover  { color: var(--primary); border-color: var(--primary); }
.s-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Панели ─────────────────────────────────────────────── */
.s-panel { display: none; }
.s-panel.active { display: block; }

/* ─── Обычные поля (текст, select, textarea) ─────────────── */
.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 660px;
}
.setting-row--wide {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: .75rem 1.25rem;
  align-items: start;
}
.setting-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  padding-top: .5rem;
  line-height: 1.4;
}
.setting-control {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.setting-hint  { font-size: .8rem; color: var(--text-muted); line-height: 1.45; }
.setting-error { font-size: .8rem; color: #dc2626; }
.setting-code  { font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; font-size: .82rem; }

/* ─── Сетка цветов ───────────────────────────────────────── */
.settings-colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem 1.5rem;
}
.settings-colors-grid .setting-row {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.settings-colors-grid .setting-label {
  font-size: .82rem;
  padding-top: 0;
}

/* ─── Color picker ───────────────────────────────────────── */
.cp-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cp-native {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 36px;
  padding: 2px 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .15s;
}
.cp-native:hover  { border-color: var(--primary); }
.cp-native::-webkit-color-swatch-wrapper { padding: 0; }
.cp-native::-webkit-color-swatch { border: none; border-radius: 4px; }
.cp-native::-moz-color-swatch    { border: none; border-radius: 4px; }
.cp-hex {
  width: 96px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: lowercase;
}
.cp-wrap.has-error .cp-native,
.cp-wrap.has-error .cp-hex { border-color: #dc2626; }

/* ─── Кнопка сохранения (sticky внизу) ──────────────────── */
.settings-save-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  bottom: 1rem;
  box-shadow: var(--shadow);
  z-index: 10;
  max-width: 660px;
}

/* ─── Адаптив ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .setting-row--wide {
    grid-template-columns: 1fr;
    gap: .35rem;
  }
  .setting-label { padding-top: 0; }
  .settings-save-bar { max-width: 100%; position: static; }
  .settings-colors-grid { grid-template-columns: 1fr; }
}

/* ─── Тёмная тема ────────────────────────────────────────── */
[data-theme="dark"] .s-tab        { background: var(--surface-2); }
[data-theme="dark"] .settings-save-bar { background: var(--surface-2); }

/* ═══════════════════════════════════════════════════════════
   Виджет блокировок (вкладка Безопасность)
   ═══════════════════════════════════════════════════════════ */
.sec-block-widget {
  margin-top: 1.75rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 660px;
}
.sec-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.sec-block-title {
  font-weight: 600;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sec-block-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 .4rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
}
.sec-block-badge--red { background: #fee2e2; color: #b91c1c; }
.sec-block-badge--ok  { background: #dcfce7; color: #166534; }
.sec-block-empty {
  margin-top: .75rem;
  color: var(--text-muted);
  font-size: .875rem;
}
.sec-block-reset { color: #dc2626; border-color: #fca5a5; }
.sec-block-reset:hover { background: #fee2e2; color: #b91c1c; border-color: #f87171; }

[data-theme="dark"] .sec-block-badge--red { background: #3b0a0a; color: #fca5a5; }
[data-theme="dark"] .sec-block-badge--ok  { background: #052e16; color: #86efac; }

/* ═══════════════════════════════════════════════════════════
   Статус-бейджи (песни, пользователи)
   ═══════════════════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.status-badge--published,
.status-badge--active {
  background: #dcfce7;
  color: #15803d;
}
.status-badge--pending {
  background: #fef9c3;
  color: #854d0e;
}
.status-badge--rejected,
.status-badge--banned {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .status-badge--published,
[data-theme="dark"] .status-badge--active  { background: #14532d; color: #86efac; }
[data-theme="dark"] .status-badge--pending  { background: #713f12; color: #fde68a; }
[data-theme="dark"] .status-badge--rejected,
[data-theme="dark"] .status-badge--banned   { background: #7f1d1d; color: #fca5a5; }

/* ═══════════════════════════════════════════════════════════
   Страницы авторизации (login.php, register.php)
   ═══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: calc(100vh - 14rem);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 3rem;
  padding-bottom: 3rem;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2rem 1.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 .25rem;
  color: var(--text);
}
.auth-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-footer-link {
  margin-top: 1.25rem;
  font-size: .875rem;
  color: var(--text-muted);
  text-align: center;
}
.auth-footer-link a { color: var(--primary); }

/* Кнопка во всю ширину */
.btn-full { width: 100%; justify-content: center; }

/* Ошибка поля формы */
.form-error {
  font-size: .78rem;
  color: #dc2626;
  margin-top: .1rem;
}
.form-group.has-error .form-input,
.form-group.has-error .form-select,
.form-group.has-error .form-textarea {
  border-color: #ef4444;
}
.form-hint {
  font-size: .78rem;
  color: var(--text-muted);
}
span.required { color: #ef4444; }

/* ═══════════════════════════════════════════════════════════
   Карточки статистики (admin/index.php)
   ═══════════════════════════════════════════════════════════ */
.stat-card--warn {
  border-color: #fbbf24;
  background: #fffbeb;
}
.stat-card--warn .stat-value { color: #b45309; }
.stat-card--warn .stat-label { color: #92400e; }
.stat-link {
  display: inline-block;
  margin-top: .4rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.stat-link:hover { text-decoration: underline; }

[data-theme="dark"] .stat-card--warn {
  background: #1c1200;
  border-color: #78350f;
}
[data-theme="dark"] .stat-card--warn .stat-value { color: #fcd34d; }
[data-theme="dark"] .stat-card--warn .stat-label  { color: #fde68a; }

/* ═══════════════════════════════════════════════════════════
   Сетка страницы добавления песни (submit.php / admin/add.php)
   ═══════════════════════════════════════════════════════════ */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: flex-start;
}
.admin-form-col  { min-width: 0; }
.admin-preview-col { min-width: 0; position: sticky; top: 5rem; }
.admin-preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-y: auto;
  max-height: 75vh;
}
.preview-header { margin-bottom: .75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.preview-song-title  { font-size: 1.1rem; font-weight: 700; margin: 0 0 .2rem; color: var(--text); }
.preview-song-artist { font-size: .875rem; color: var(--text-muted); margin: 0; }
.preview-lyrics { font-size: .9rem; }
.form-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .25rem;
}
.lyrics-textarea { min-height: 420px; }

@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-preview-col { position: static; }
  .admin-preview-card { max-height: 300px; }
}

/* Навигационная ссылка с выделением */
.nav-link--register {
  background: var(--primary);
  color: #fff !important;
  padding: .35rem .85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background .2s;
}
.nav-link--register:hover { background: var(--primary-dark); }
.nav-link--logout { color: var(--text-muted) !important; }
[data-theme="dark"] .sec-block-widget     { background: var(--surface-2); }

/* ═══════════════════════════════════════════════════════════
   Личный кабинет (my-songs.php)
   ═══════════════════════════════════════════════════════════ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.profile-name {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 .15rem;
  color: var(--text);
}
.profile-email {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0;
}

/* Сетка настроек аккаунта */
.account-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: flex-start;
}
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.account-card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.account-card-current {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0;
  padding: .5rem .75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .profile-header { gap: .75rem; }
  .profile-header .btn { width: 100%; justify-content: center; }
  .account-settings-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   Навигация — адаптивные иконки (header + admin_nav)
   ═══════════════════════════════════════════════════════════ */
.nav-logout-text,
.nav-add-text,
.nav-user-text,
.nav-admin-text,
.nav-login-text,
.nav-reg-text,
.admin-add-text { display: inline; }

.nav-logout-icon,
.nav-add-icon,
.nav-user-icon,
.nav-admin-icon,
.nav-login-icon,
.nav-reg-icon,
.admin-add-icon { display: none; }

@media (max-width: 640px) {
  .nav-logout-text,
  .nav-add-text,
  .nav-user-text,
  .nav-admin-text,
  .nav-login-text,
  .nav-reg-text,
  .admin-add-text { display: none !important; }

  .nav-logout-icon,
  .nav-add-icon,
  .nav-user-icon,
  .nav-admin-icon,
  .nav-login-icon,
  .nav-reg-icon,
  .admin-add-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
  }

  a.nav-link--logout,
  a.nav-link--add,
  a.nav-link--user,
  a.nav-link--admin,
  a.nav-link--login,
  a.nav-link--register {
    padding: .28rem .5rem !important;
    font-size: 0 !important;
  }

  a.admin-nav-add {
    background: var(--primary-light, rgba(99,102,241,.12)) !important;
    color: var(--primary, #6366f1) !important;
    padding: .35rem .6rem !important;
    font-size: 0 !important;
  }

  a.admin-nav-add.active,
  a.admin-nav-add:hover {
    background: var(--primary-light, rgba(99,102,241,.2)) !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   Diff-просмотр правок (admin/songs.php)
   ═══════════════════════════════════════════════════════════ */
.diff-wrap  { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border);
              border-radius: var(--radius-sm); overflow: hidden; font-size: .78rem; line-height: 1.6; }
.diff-col-l { border-right: 1px solid var(--border); min-width: 0; }
.diff-col-r { min-width: 0; }
.diff-head  { padding: 5px 10px; font-weight: 700; font-size: .8rem; background: var(--surface-2);
              border-bottom: 1px solid var(--border); font-family: inherit; }
.diff-line  { padding: 1px 10px; white-space: pre-wrap; word-break: break-word; font-family: monospace;
              min-height: 1.6em; }
.diff-del   { background: rgba(239,68,68,.12); color: #991b1b; }
.diff-add   { background: rgba(34,197,94,.12);  color: #166534; }
.diff-ph    { background: rgba(0,0,0,.025); }

/* ═══════════════════════════════════════════════════════════
   Сборники — мобильная адаптация (my-songs.php)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .coll-block-head  { display: flex !important; align-items: center !important; flex-wrap: nowrap !important;
                      gap: .5rem !important; padding: .4rem .75rem !important; }
  .coll-block-del   { flex-shrink: 0 !important; }
  .coll-block-count { display: none !important; }
  .drag-handle      { padding: 14px 17px !important; opacity: .65 !important; }
  .coll-rename-btn  { opacity: .6 !important; padding: 10px !important; }
  .coll-block-song  { display: flex !important; list-style: none !important; align-items: center !important;
                      gap: .5rem !important; padding: .3rem .75rem !important; }
  .coll-song-artist { display: none !important; }
  .coll-song-info   { flex-wrap: nowrap !important; overflow: hidden !important; }
  .coll-song-title  { white-space: nowrap !important; overflow: hidden !important;
                      text-overflow: ellipsis !important; min-width: 0 !important; }
  .coll-rm-btn      { padding: .45rem .55rem !important; font-size: 1rem !important; }
}

/* ═══════════════════════════════════════════════════════════
   Шапка — компактный мобильный вид
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  :root { --header-h: 48px; }

  .site-logo { font-size: .95rem; gap: .3rem; }
  .site-logo svg { width: 20px; height: 20px; }

  .site-nav { gap: .05rem; }
  .nav-link  { padding: .28rem .5rem; font-size: .82rem; }

  /* «Регистрация» — уменьшаем, но оставляем видимой */
  .nav-link--register { padding: .28rem .6rem; }
}

/* ═══════════════════════════════════════════════════════════
   Схемы аккордов — всплывающая диаграмма (chord-diagrams.js)
   ═══════════════════════════════════════════════════════════ */
.ly-chord {
  cursor: pointer;
  border-radius: 3px;
  transition: background .1s, color .1s;
}
.ly-chord:hover {
  background: var(--primary-light);
  color: var(--primary);
}
#chord-popup {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity .12s, visibility .12s;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.1);
  line-height: 1;
}
#chord-popup.chord-popup--on {
  visibility: visible;
  opacity: 1;
}
@media print {
  #chord-popup { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   Автопрокрутка — плавающая кнопка (autoscroll.js)
   ═══════════════════════════════════════════════════════════ */
.asc-bar {
  position: fixed;
  bottom: 1.25rem; /* fallback for iOS < 11.2 where env() is unsupported */
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  right: .9rem;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: .1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: .2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.07);
  transition: box-shadow .2s, border-color .2s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation; /* none blocked child click synthesis on iOS Safari */
}
.asc-bar--on {
  border-color: var(--primary);
  box-shadow: 0 2px 16px rgba(99,102,241,.25), 0 1px 4px rgba(0,0,0,.08);
}

.asc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  transition: background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
}
.asc-btn:not(:disabled):hover,
.asc-btn:not(:disabled):active {
  background: var(--primary-light);
  color: var(--primary);
}
.asc-btn:disabled { opacity: .3; cursor: default; }

.asc-play {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--primary-light);
  color: var(--primary);
}
.asc-bar--on .asc-play {
  background: var(--primary);
  color: #fff;
}

.asc-speed {
  font-size: .68rem;
  min-width: 1.75rem;
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
  padding-right: .35rem;
  line-height: 1;
}
.asc-bar--on .asc-speed {
  color: var(--primary);
  font-weight: 700;
}

@media print {
  .asc-bar { display: none !important; }
}

/* ── Offline indicator ────────────────────────────────────────────────────── */
.offline-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 3000;
  background: #dc2626;
  color: #fff;
  font-size: .82rem;
  font-weight: 500;
  padding: .45rem 1rem;
  letter-spacing: .01em;
}
.is-offline .offline-bar { display: flex; }
