/* app/static/css/database.css */
/* Общие стили */
:root {
    --database-shell-offset: calc(var(--backend-shell-height, 0px) + var(--backend-body-top-gap, 6px));
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

body.pdf-modal-open {
    overflow: hidden;
}

/* Основной контейнер на все окно */
.container {
    display: flex;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    gap: 10px;
}

/* Левый контейнер */
.left-container {
    width: 40%;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    background-color: #fff;
    border-right: 1px solid #ddd; /* Разделитель */
    gap: 10px;
}

/* Под-контейнеры в левом контейнере размещены горизонтально */
.left-container-inner {
    display: flex;
    gap: 10px;
    flex-grow: 1;
}

/* Контейнер для тегов */
.tags-container {
    flex: none; /* Отменяем автоматическое растяжение */
    width: auto; /* Ширина подстраивается под содержимое */
    overflow-y: auto; /* Прокрутка по вертикали, если тегов много */
}

/* Контейнер для полей */
.fields-container {
    flex-grow: 1; /* Контейнер для полей растягивается по ширине */
    max-width: 100%; /* Ограничение максимальной ширины для полей */
}

/* Контейнер для других тегов на всю ширину */
.other-tags-container {
    width: 100%;
    margin-top: 10px;
}

#otherTags {
    width: 100%;
    min-height: 40px;
    padding: 8px;
    margin: 5px 0 10px 0;
    border: 1px solid #ccc;
    box-sizing: border-box;
    resize: none;
    overflow: hidden;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Правый контейнер для поиска и списка */
.right-container {
    width: 60%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 10px;
}

/* Поля ввода и чекбоксы */
input[type="text"] {
    width: 100%;
    padding: 8px;
    margin: 5px 0 10px 0;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

/* Время ввода */
.time-inputs {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Чекбоксы */
.tag-checkbox {
    margin-bottom: 5px;
}

/* Кнопки */
button {
    padding: 8px 10px;
    margin-top: 10px;
    border: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    text-align: center;
}

button:hover {
    background-color: #0056b3;
}

.database-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background: transparent !important;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.database-icon-button svg {
    width: 40px;
    height: 40px;
    display: block;
}

.database-icon-button:hover {
    background: transparent !important;
}

.database-icon-button:active {
    transform: scale(0.97);
}

.database-icon-button:disabled {
    opacity: 0.55;
    filter: saturate(0.35);
}

/* Список песен */
#searchBar,
#searchBarMobile {
    padding-right: 40px;
}

.search-input-shell {
    position: relative;
    width: 100%;
}

.search-clear-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64' role='img' aria-label='Delete'%3E%3Crect x='2' y='2' width='60' height='60' rx='12' fill='%231E66FF'/%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-width='4' stroke-linecap='round'%3E%3Cpath d='M22 22l20 20'/%3E%3Cpath d='M42 22l-20 20'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
    cursor: pointer;
    display: none;
}

.search-clear-btn.is-visible {
    display: block;
}

.search-clear-btn:hover {
    filter: brightness(0.95);
}

.search-clear-btn:focus-visible {
    outline: 2px solid #1e66ff;
    outline-offset: 1px;
}

#searchBar {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

#searchBarMobile {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #c7ccd4;
    border-radius: 10px;
    box-sizing: border-box;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* Список песен */
.song-list {
    flex-grow: 1;
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0;
}

.song-list li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
}

/* Эффект при наведении на песню */
.song-list li:hover {
    background-color: #c8c4ff; /* Очень светлый синий */
}

/* Указатель мыши для чекбоксов */
input[type="checkbox"] {
    cursor: pointer;
}

/* Поля для минут и секунд */
.time-inputs input[type="text"] {
    width: 10ch; /* Ширина, подходящая для двух символов и небольшого отступа */
    padding: 8px;
    text-align: center; /* Центрируем текст */
    margin: 5px 0;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

.selected {
    background-color: #c8c4ff;
}
/* Для каждого аудио-блока — колоночная верстка */
.audio-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 1em;  /* отступ между аудио-блоками */
}

.audio-container {
  padding-top: 20px;
}

/* Верхний ряд: label + file-input */
.audio-top {
  display: flex;
  align-items: center;
  gap: 8px;    /* расстояние между лейблом и кнопкой выбора файла */
}


/* прячем все file-input в блоках audio-top */
.audio-top input[type="file"] {
  display: none !important;
}

/* Обёртка поля + крестик внутри */
.file-input-wrapper {
  display: flex;            /* флекс-контейнер */
  align-items: center;      /* вертикальный центр */
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ccc;   /* рамка вместо у input */
  border-radius: 2px;
  background: #fff;
  overflow: visible;
}

.file-input-wrapper input[readonly] {
  flex: 1;                  /* поле занимает всё свободное место */
  border: none;             /* у поля нет собственной рамки */
  padding: 8px;             /* внутренние отступы */
  margin: 0;
  background: transparent;
  white-space: nowrap;
  overflow-x: auto;
  cursor: pointer;
}

.file-input-wrapper .browse-btn,
.file-input-wrapper .delete-icon-btn,
.file-input-wrapper .remove-slot-btn {
  flex: none;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.file-input-wrapper .browse-btn {
  background-image: none;
}

#videoSelect1,
#videoSelect2 {
  width: 100%;
  padding: 8px;
  margin: 5px 0 10px 0;
  border: 1px solid #ccc;
  box-sizing: border-box;
  background: #fff;
}

.editable-bpm-label {
  cursor: pointer;
  text-decoration: underline dashed;
  text-underline-offset: 2px;
}

.file-input-wrapper .browse-btn svg {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto;
  pointer-events: none;
}

.file-input-wrapper .delete-icon-btn {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64' role='img' aria-label='Delete'%3E%3Crect x='2' y='2' width='60' height='60' rx='12' fill='%231E66FF'/%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-width='4' stroke-linecap='round'%3E%3Cpath d='M22 22l20 20'/%3E%3Cpath d='M42 22l-20 20'/%3E%3C/g%3E%3C/svg%3E");
}

.file-input-wrapper .remove-slot-btn {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64' role='img' aria-label='Remove stream'%3E%3Crect x='2' y='2' width='60' height='60' rx='12' fill='%231E66FF'/%3E%3Cpath d='M20 32h24' fill='none' stroke='%23FFFFFF' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.file-input-wrapper .browse-btn:hover,
.file-input-wrapper .delete-icon-btn:hover,
.file-input-wrapper .remove-slot-btn:hover {
  filter: brightness(0.95);
}

.file-input-wrapper .browse-btn:focus-visible,
.file-input-wrapper .delete-icon-btn:focus-visible,
.file-input-wrapper .remove-slot-btn:focus-visible {
  outline: 2px solid #1e66ff;
  outline-offset: -2px;
}

.pdf-generate-btn {
  margin-top: 0;
  margin-left: 8px;
  padding: 6px 10px;
}

.pdf-generator-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 14px;
}

.pdf-generator-modal.active {
  display: flex;
}

.pdf-generator-card {
  width: min(920px, calc(100vw - 28px));
  height: var(--pdf-generator-modal-height, min(90vh, calc(100vh - 28px)));
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  padding: 10px 16px 16px;
  box-sizing: border-box;
  -webkit-text-size-adjust: none !important;
  text-size-adjust: none !important;
}

.pdf-generator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pdf-generator-header h3 {
  margin: 0;
}

.pdf-generator-section-title {
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: 600;
  text-align: center;
}

.pdf-page-settings-dialog .pdf-generator-header {
  position: relative;
  justify-content: center;
}

.pdf-page-settings-dialog .pdf-generator-header h4 {
  margin: 0;
  text-align: center;
}

.pdf-page-settings-dialog .pdf-generator-header .pdf-generator-close {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.pdf-generator-close {
  border: none;
  background: transparent;
  color: inherit;
  margin: 0;
  line-height: 0;
  padding: 0;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pdf-generator-close svg {
  display: block;
}

.pdf-generator-grid {
  display: grid;
  gap: 10px 12px;
  margin-top: 0;
}

.pdf-generator-grid-main {
  grid-template-columns: 1fr;
  justify-items: center;
  margin-bottom: 8px;
}

.pdf-generator-grid-offsets {
  grid-template-columns: 1fr;
  justify-items: center;
}

.pdf-page-settings-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.pdf-page-settings-modal.is-collapsed {
  display: none;
}

.pdf-page-settings-dialog {
  width: min(860px, calc(100% - 24px));
  max-height: calc(90vh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
}

.notes-editor-dialog {
  width: min(1000px, calc(100% - 24px));
  padding-top: 12px;
}

.notes-editor-dialog .pdf-generator-header {
  justify-content: flex-start;
  min-height: 40px;
  margin-bottom: 8px;
}

.pdf-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pdf-field label {
  display: block;
  margin-bottom: 4px;
}

.pdf-field input[type="text"],
.pdf-field input[type="number"] {
  margin: 0;
}

.pdf-field input[type="number"] {
  width: 220px;
}

.pdf-page-settings-dialog .pdf-field input[type="text"],
.pdf-page-settings-dialog .pdf-field select {
  width: 220px;
}

.preset-actions-field {
  display: flex;
  flex-direction: row;
  align-items: center !important;
  justify-content: center;
  gap: 8px;
}

.pdf-field-title {
  max-width: 60ch;
  width: min(60ch, 100%);
}

.pdf-field-title-row {
  align-items: stretch;
}

.pdf-title-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.pdf-field-title input[type="text"] {
  width: 100%;
  flex: 1 1 auto;
}

.pdf-generator-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin-top: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  padding: 0 0 8px 0;
  border-bottom: 1px solid #e6e6e6;
}

.pdf-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  width: 100%;
}

.pdf-toolbar-primary {
  align-items: stretch;
}

.pdf-mode-switch .mode-btn,
#constructorModeSwitch .mode-btn {
  margin-top: 0;
  min-width: 92px;
  min-height: 34px;
  padding: 0 10px;
}

.pdf-mode-switch .mode-btn.active,
#constructorModeSwitch .mode-btn.active {
  background: #0f4bb8;
}

.pdf-editor-toolbar,
.pdf-toolbar-size-color,
.pdf-toolbar-align,
.pdf-toolbar-edit {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.is-hidden {
  display: none !important;
}

.pdf-toolbar-row.is-disabled {
  opacity: 0.48;
}

.pdf-toolbar-row.is-disabled button,
.pdf-toolbar-row.is-disabled input,
.pdf-toolbar-row.is-disabled summary {
  pointer-events: none;
}

.notes-tools-row button {
  margin-top: 0;
}

.notes-tools-row .notes-grid-step-select {
  margin-top: 0;
  height: 34px;
  padding: 0 8px;
}

#notesGridScaleInput {
  width: 72px;
  margin: 0;
}

#notesGridBpmInput {
  width: 72px;
  margin: 0;
}

.notes-grid-panel {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #d7dbe3;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.notes-grid-canvas {
  min-width: max-content;
}

.notes-grid-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.notes-grid-row:last-child {
  margin-bottom: 0;
}

.notes-grid-row-label {
  width: 36px;
  min-width: 36px;
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
  color: #1f2f50;
}

.notes-grid-row.is-staff-line .notes-grid-cells {
  border-top: 1px solid #bcc6d8;
  padding-top: 3px;
}

.notes-grid-row--cymbal .notes-grid-row-label,
.notes-grid-row--hat .notes-grid-row-label {
  color: #0f4bb8;
}

.notes-grid-row--kick {
  margin-top: 2px;
}

.notes-grid-cells {
  display: flex;
  align-items: center;
  gap: 2px;
}

.notes-grid-cell {
  width: 20px;
  height: 20px;
  border: 1px solid #aeb8cb;
  border-radius: 3px;
  background: #f4f7fc;
  cursor: pointer;
  margin: 0;
  padding: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.notes-grid-cell:focus,
.notes-grid-cell:focus-visible {
  outline: none;
}

.notes-grid-cell.is-active {
  background: #0f4bb8;
  border-color: #0a3a8f;
}

.notes-grid-cell.is-active.is-delete-hover {
  background: #d13a3a;
  border-color: #a61f1f;
}

.notes-grid-cell.is-playing {
  box-shadow: 0 0 0 2px #ff9d00 inset;
  border-color: #ff9d00;
}

.notes-grid-cell.is-active.is-playing {
  background: #1a63d8;
}

.notes-grid-cell.is-quarter {
  border-left-width: 2px;
}

.notes-grid-cell.is-beat {
  border-left-width: 3px;
  border-left-color: #7f8fb3;
}

.notes-grid-sep {
  width: 8px;
  min-width: 8px;
}

.pdf-editor-toolbar label {
  margin: 0;
}

#selectionFontSizeInput {
  width: 84px;
  margin: 0;
}

@media (min-width: 971px) {
  #selectionFontSizeInput {
    -moz-appearance: textfield;
    appearance: textfield;
  }
  #selectionFontSizeInput::-webkit-outer-spin-button,
  #selectionFontSizeInput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
}

.font-step-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  line-height: 1;
  font-size: 20px;
}

.pdf-icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.pdf-icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.pdf-icon-btn.success {
  background: #16a34a;
}

.pdf-icon-btn.success:hover {
  background: #15803d;
}

.pdf-icon-btn.danger {
  background: #dc2626;
}

.pdf-icon-btn.danger:hover {
  background: #b91c1c;
}

.pdf-color-menu {
  position: relative;
}

.pdf-color-menu > summary {
  list-style: none;
  border: none;
}

.pdf-color-menu > summary.pdf-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #1d7cf2;
  color: #ffffff;
  cursor: pointer;
}

.pdf-color-menu > summary::-webkit-details-marker {
  display: none;
}

.pdf-color-menu > summary.pdf-icon-btn:hover {
  background: #0f67d8;
}

.pdf-color-palette {
  display: flex;
  gap: 4px;
}

.pdf-color-menu .pdf-color-palette {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  flex-wrap: wrap;
  padding: 6px;
  border: 1px solid #c9d4e6;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  z-index: 30;
}

.pdf-color-menu[open] .pdf-color-palette {
  display: flex;
}

.pdf-color-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #777;
  margin: 0;
  padding: 0;
  background: #000;
}

.pdf-color-btn[data-color="#000000"] { background: #000000; }
.pdf-color-btn[data-color="#ff0000"] { background: #ff0000; }
.pdf-color-btn[data-color="#008000"] { background: #008000; }
.pdf-color-btn[data-color="#0000ff"] { background: #0000ff; }
.pdf-color-btn[data-color="#ffa500"] { background: #ffa500; }
.pdf-color-btn[data-color="#800080"] { background: #800080; }
.pdf-color-btn[data-color="#8b4513"] { background: #8b4513; }

#alignLeftBtn.active,
#alignCenterBtn.active,
#alignRightBtn.active {
  background-color: #0056b3;
}

.lyrics-blocks-container {
  margin-top: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding-bottom: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.lyrics-blocks-container::-webkit-scrollbar {
  display: none;
}

.lyrics-block {
  border: none;
  border-radius: 0;
  padding: 0;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2px;
  position: relative;
}

.lyrics-block-top {
  position: static;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 560px;
  margin: 0 auto;
}

.lyrics-block-top label {
  font-size: 13px;
  margin: 0;
  color: #50627f;
  letter-spacing: 0.04em;
}

.lyrics-page-preview {
  width: 560px;
  height: 315px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0;
  --overflow-top-color: #bdbdbd;
  --overflow-right-color: #bdbdbd;
  --overflow-bottom-color: #bdbdbd;
  --overflow-left-color: #bdbdbd;
  border-top: 2px solid var(--overflow-top-color);
  border-right: 2px solid var(--overflow-right-color);
  border-bottom: 2px solid var(--overflow-bottom-color);
  border-left: 2px solid var(--overflow-left-color);
  background: #ffffff;
  position: relative;
  overflow: hidden;
}

.lyrics-block.is-selected-page .lyrics-page-preview {
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}
.lyrics-page-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  will-change: transform;
}

.lyrics-page-preview.overflow-top {
  --overflow-top-color: #ef4444;
}

.lyrics-page-preview.overflow-right {
  --overflow-right-color: #ef4444;
}

.lyrics-page-preview.overflow-bottom {
  --overflow-bottom-color: #ef4444;
}

.lyrics-page-preview.overflow-left {
  --overflow-left-color: #ef4444;
}

.lyrics-frame-wrap {
  position: absolute;
}

.lyrics-page-title-preview {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  text-align: center;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1;
  color: #000;
  pointer-events: none;
  z-index: 2;
}

.lyrics-frame {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 40pt;
  line-height: 1.2;
  padding: 0;
  border: none;
  background: #ffffff;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  outline: none;
  -webkit-text-size-adjust: none !important;
  text-size-adjust: none !important;
}

.lyrics-frame.instrument-mode {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.lyrics-frame::-webkit-scrollbar {
  display: none;
}

/* Keep line spacing consistent even if old inline styles remain in pasted/edited nodes */
.lyrics-frame * {
  line-height: 1.2 !important;
}

.lyrics-frame .drum-notation-block {
  position: absolute;
  left: 16px;
  top: 16px;
  width: min(520px, 85%);
  line-height: 0 !important;
  font-size: 0;
  vertical-align: middle;
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 5;
}

.lyrics-frame .drum-notation-svg {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  vertical-align: top;
}

.lyrics-frame .drum-notation-block.is-selected {
  outline: 2px solid #0f4bb8;
  outline-offset: 2px;
}

.lyrics-frame .drum-notation-resize-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  right: -12px;
  bottom: -12px;
  border-radius: 50%;
  border: 2px solid #0f4bb8;
  background: #ffffff;
  cursor: nwse-resize;
  z-index: 10;
  display: none;
  touch-action: none;
}

.lyrics-frame .drum-notation-block.is-selected .drum-notation-resize-handle {
  display: block;
}

.lyrics-frame .text-overlay-block {
  position: absolute;
  left: 16px;
  top: 16px;
  width: min(520px, 70%);
  height: 160px;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 4;
}

.lyrics-frame .text-overlay-block.is-selected {
  outline: 2px solid #0f4bb8;
  outline-offset: 1px;
}

.lyrics-frame .text-overlay-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  outline: none;
  cursor: move;
  user-select: text;
  -webkit-user-select: text;
  color: #000;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.15 !important;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  overflow: hidden;
  touch-action: manipulation;
}

.lyrics-frame .text-overlay-content * {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.15 !important;
}

.lyrics-frame .text-overlay-block:not(.is-editing) .text-overlay-content {
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
}

.lyrics-frame .text-overlay-block.is-editing .text-overlay-content {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.lyrics-frame .text-overlay-content:empty::before {
  content: attr(data-placeholder);
  color: #8f8f8f;
}

.lyrics-frame .text-overlay-resize-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  right: -12px;
  bottom: -12px;
  border-radius: 50%;
  border: 2px solid #0f4bb8;
  background: #ffffff;
  cursor: nwse-resize;
  z-index: 10;
  display: none;
  touch-action: none;
}

.lyrics-frame .text-overlay-block.is-selected .text-overlay-resize-handle {
  display: block;
}

.row {
    display: flex;
    justify-content: space-between; /* Прижимаем первый элемент к левому краю, а последний — к правому */
    align-items: center; /* Центрируем по вертикали */
    width: 100%; /* Строка занимает всю ширину */
    padding: 0; /* Без внутренних отступов */
    margin: 0; /* Без внешних отступов */
    box-sizing: border-box; /* Учитываем ширину и border */
}

.column {
    text-align: left; /* Центрируем содержимое в колонке */
}

.row .column {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 0 10px;
}

.column svg {
    width: 40px; /* Ширина SVG */
    height: 40px; /* Высота SVG */
    cursor: pointer;
    margin: 10px;
}
.str1 {stroke:#FEFEFE;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:22.9256}
.str0 {stroke:#FEFEFE;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:22.9256}
.fil1 {fill:none}
.fil0 {fill:#007BFF}

/* Mobile (phones) layout */
@media (max-width: 970px) {
  :root {
    --database-mobile-toolbar-gap: 4px;
    --database-mobile-toolbar-height: 76px;
  }

  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    padding-top: calc(
      var(--database-shell-offset, calc(var(--backend-shell-height, 0px) + var(--backend-body-top-gap, 6px)))
      + var(--database-mobile-toolbar-gap)
      + var(--database-mobile-toolbar-height)
    );
    box-sizing: border-box;
  }

  .database-mobile-toolbar {
    display: block;
    position: fixed;
    top: var(--database-shell-offset, calc(var(--backend-shell-height, 0px) + var(--backend-body-top-gap, 6px)));
    left: 0;
    right: 0;
    z-index: 1700;
    margin-top: 0;
    padding: 0 8px 6px;
    margin-bottom: var(--database-mobile-toolbar-gap);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid #e5e7eb;
  }

  .database-mobile-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
  }

  .database-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .database-icon-button svg {
    width: 40px;
    height: 40px;
    display: block;
  }

  .database-mobile-search {
    width: 100%;
    display: block;
  }

  #searchBarMobile {
    padding: 3px 8px;
    margin: 0;
  }

  .database-icon-button:active {
    transform: scale(0.97);
  }

.database-icon-button:disabled {
    opacity: 0.55;
    filter: saturate(0.35);
  }

  /* Основной контейнер переходит в колонку */
  .container {
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  /* Сначала показываем правую колонку (поиск + список) */
  .right-container {
    order: 1;
    width: 100%;
    padding: 0 10px 2px;
    border: none;
    flex: 0 0 auto;
    overflow: visible;
  }

  .right-container > #searchBar {
    display: none;
  }

  .right-container > .search-input-shell {
    display: none;
  }

  .right-container .search-input-shell {
    margin-top: 0;
  }

  .right-container #searchBar {
    margin-top: 0;
    margin-bottom: 4px;
  }

  /* Потом — левую (вся форма) */
  .left-container {
    order: 2;
    width: 100%;
    padding: 10px;
    border: none;
    border-top: 1px solid #ddd;
    margin-top: 0;
    flex: 0 0 auto;
    overflow: visible;
  }

  .left-container > .row {
    display: none;
  }

  /* Внутри формы — тоже колонки в одну линию */
  .left-container-inner {
    flex-direction: column;
  }

  /* Теги и поля растягиваются на всю ширину */
  .tags-container,
  .fields-container {
    width: 100%;
    box-sizing: border-box;
  }

  /* Ограничим высоту списка, чтобы было ~8–10 строк */
  .song-list {
    max-height: 34vh;
    margin-top: 0;
    margin-bottom: 2px;
  }

  /* Поля ввода в форму можно чуть уменьшить */
  input[type="text"],
  textarea,
  .time-inputs input[type="text"],
  select {
    font-size: 1em;
    padding: 6px;
  }

  /* Кнопки растянуть на всю ширину */
  .buttons button {
    display: block;
    width: 100%;
    margin: 5px 0;
  }

  .pdf-generator-grid {
    grid-template-columns: 1fr;
  }

  .pdf-generator-grid-main,
  .pdf-generator-grid-offsets {
    grid-template-columns: 1fr;
  }

  .lyrics-block-top {
    width: 100%;
    max-width: 560px;
  }

  .pdf-generator-modal {
    padding: 0;
    align-items: flex-start;
  }

  .pdf-generator-card {
    width: 100vw;
    max-width: 100vw;
    height: var(--pdf-generator-modal-height, 100dvh);
    min-height: var(--pdf-generator-modal-height, 100dvh);
    max-height: var(--pdf-generator-modal-height, 100dvh);
    border-radius: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 4px) 10px 0;
    overflow: hidden;
  }

  .pdf-page-settings-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  .pdf-generator-actions {
    gap: 6px;
    padding-bottom: 6px;
  }

  .pdf-toolbar-row,
  .pdf-editor-toolbar,
  .pdf-toolbar-size-color,
  .pdf-toolbar-align,
  .pdf-toolbar-edit {
    gap: 3px;
  }

  .pdf-icon-btn,
  .font-step-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .lyrics-frame .drum-notation-resize-handle,
  .lyrics-frame .text-overlay-resize-handle {
    width: 30px;
    height: 30px;
    right: -15px;
    bottom: -15px;
    border-width: 3px;
  }

  #selectionFontSizeInput {
    width: 70px;
  }

  .lyrics-block {
    padding-top: 0;
  }

  .pdf-title-input-row {
    gap: 6px;
  }

  #constructorModeSwitch .mode-btn {
    min-width: 76px;
    min-height: 32px;
    padding: 0 8px;
  }

  .other-tags-container {
    margin-top: 14px;
  }
}

@media (min-width: 971px) {
  .left-container .row {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
  }

  .database-top-icon-row {
    justify-content: flex-start;
    gap: 0;
    margin-bottom: 0;
  }

  .database-top-icon-row .column {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 4px 0 0 0;
  }

  .database-top-icon-row .column + .column {
    padding-left: 8px;
  }

  .database-top-icon-row .column svg {
    margin: 0;
  }

  .left-container,
  .right-container {
    margin-top: 0 !important;
    padding-top: 0;
  }
}
.transform-controls {
  margin-top: 15px; /* отступ сверху, как у других групп */
}

.transform-controls div {
  margin-bottom: 10px; /* как у остальных input */
}

.transform-controls label {
  display: block;
  margin-bottom: 5px;
  font-weight: normal;
}

.transform-controls input[type="number"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.number-stepper {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 2px;
  background: #fff;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.number-stepper input[type="number"] {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: none;
  padding: 8px;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.number-stepper input[type="number"]::-webkit-outer-spin-button,
.number-stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.step-btn.transform-step-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  line-height: 1;
  font-size: 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.step-btn.transform-step-btn[data-dir="down"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Crect x='2' y='2' width='60' height='60' rx='12' fill='%231E66FF'/%3E%3Cpath d='M22 32h20' fill='none' stroke='%23FFFFFF' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.step-btn.transform-step-btn[data-dir="up"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Crect x='2' y='2' width='60' height='60' rx='12' fill='%231E66FF'/%3E%3Cpath d='M22 32h20M32 22v20' fill='none' stroke='%23FFFFFF' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.step-btn.transform-step-btn:hover {
  filter: brightness(0.95);
}

.step-btn.transform-step-btn:focus-visible {
  outline: 2px solid #1e66ff;
  outline-offset: -2px;
}
