:root {
  /* Монохром: матовый чёрный + молочный белый */
  --bg-main: #050505;
  --bg-panel: #0d0d0d;
  --bg-panel-soft: #151515;
  --bg-accent: #1f1f1f;
  --accent: #f3efe7; /* молочный белый для акцентов */
  --accent-soft: #a7a39a;
  --accent-strong: #ffffff;
  --text-main: #f3efe7;
  --text-muted: #9a9488;
  --border-subtle: #262626;
  --border-strong: #3a3a3a;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.8);
  --radius-lg: 18px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition-fast: 0.18s ease-out;
  --transition-slow: 0.28s ease-out;
  --groove-color: #1a1a1a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.app-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1240px;
  height: auto;
  padding: 18px 20px 16px;
  gap: 14px;
  position: relative;
  flex-shrink: 0;
}

.app-title {
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--text-main);
  margin: 0 0 8px 0;
  text-align: center;
}

/* Верхняя панель эффектов */

.effects-bar {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-soft);
  padding: 10px 18px 7px; /* −25% по вертикали */
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
  overflow: hidden;
}

.effects-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
}

.effects-title {
  position: relative;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.effects-sliders {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.effect-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.effect-control label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 100%;
  text-align: center;
}

.effect-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 50%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--groove-color) 0%, #252525 40%, #0f0f0f 100%);
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(0, 0, 0, 0.4),
    inset 0 -1px 1px rgba(255, 255, 255, 0.04);
}

.effect-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e8e4dc 0%, #c4bfb5 100%);
  border: 2px solid var(--groove-color);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.effect-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e8e4dc 0%, #c4bfb5 100%);
  border: 2px solid var(--groove-color);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.effect-value {
  min-width: 44px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  background: #f5f3ed;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Центральная область: карточка + дорожка */

.main-layout {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto;
  column-gap: 18px;
  min-height: 0;
}

/* Список карточек слева */

.card-list {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-soft);
  padding: 10px 10px 8px;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  grid-row: 1 / 2;
  grid-column: 1 / 2;
  align-self: start;
}

.card-list-header {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 6px 2px;
}

.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card-item:hover {
  background: #1e1e1e;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.card-select {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 6px;
}

.card-select input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.card-checkbox-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #111111;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.9);
  position: relative;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card-item:hover .card-checkbox-box {
  border-color: var(--accent);
}

.card-select input[type="checkbox"]:checked + .card-checkbox-box {
  background: var(--accent);
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.card-select input[type="checkbox"]:checked + .card-checkbox-box::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 2px solid #ffffff;
}

/* Блок дорожки: чёрная область = дорожка, без серого контейнера */

.track-section {
  display: flex;
  flex-direction: column;
  background: transparent;
  padding: 0;
  gap: 4px;
  position: relative;
  overflow: hidden;
  grid-row: 1 / 2;
  grid-column: 2 / 3;
}

.track-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 2px;
}

.track-file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.track-time-strip {
  position: relative;
  width: 100%;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  margin-bottom: -2px;
}

.playhead-time {
  display: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}

.track-body {
  position: relative;
  flex: 1;
  min-height: 346px;
  background: #050505;
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md);
}

.track-waveform {
  width: 100%;
  height: 100%;
  background: #050505;
  position: relative;
  overflow: hidden;
}

.track-waveform::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to right,
    rgba(255, 255, 255, 0.04) 0,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px,
    transparent 5px
  );
  opacity: 0.6;
  pointer-events: none;
}

.track-waveform-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.track-controls {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.transport-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 13px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: #f3efe7;
  color: #050505;
  border: 1px solid #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.transport-btn i {
  font-size: 0.9rem;
}

.transport-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.9);
  filter: brightness(1.05);
}

.transport-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
}

/* Клавиши внутри дорожки */

.keyboard-keys {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 4px 10px 2px;
  overflow: hidden;
}

.keyboard-keys::before {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
}

.key {
  position: relative;
  margin: 0 2px;
  border-radius: 0 0 6px 6px; /* классическое расположение: закругление снизу */
  cursor: pointer;
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out, filter 0.06s ease-out;
}

.key.white {
  width: 32px;
  height: 80px;
  background: linear-gradient(180deg, #fdfdfd, #e4e0d8);
  box-shadow:
    0 3px 0 #8b8b8b,
    0 7px 14px rgba(0, 0, 0, 0.7);
}

.key.white:hover {
  filter: brightness(1.03);
}

.key.black {
  width: 18px;
  height: 52px;
  margin-left: -12px;
  margin-right: -12px;
  margin-bottom: 28px; /* черные клавиши над белыми */
  z-index: 2;
  background: linear-gradient(180deg, #181818, #020202);
  box-shadow:
    0 3px 0 #000000,
    0 10px 18px rgba(0, 0, 0, 0.95);
}

.key.black:hover {
  filter: brightness(1.08);
}

.key:active,
.key.key-pressed {
  transform: translateY(5px) scale(0.98);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.9),
    0 2px 4px rgba(0, 0, 0, 0.6);
}

.key.white:active,
.key.white.key-pressed {
  filter: brightness(0.9);
}

.key.black:active,
.key.black.key-pressed {
  filter: brightness(1.35);
}

/* Небольшие адаптивные корректировки по высоте */

@media (max-height: 720px) {
  .key.white {
    height: 70px;
  }

  .key.black {
    height: 46px;
  }
}

/* Модальное окно входа / регистрации */
.auth-overlay {
  display: none;
  position: fixed;
  z-index: 2000;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(5px);
}

.auth-overlay.is-open {
  display: block;
}

.auth-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100% - 32px, 420px);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-soft);
}

.auth-panel-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.auth-panel-close:hover {
  color: var(--accent);
}

.auth-panel-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 8px;
  letter-spacing: 0.04em;
}

.auth-panel-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 22px;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.auth-field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-panel-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(243, 239, 231, 0.08);
}

.auth-submit-btn {
  margin-top: 6px;
  width: 100%;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #f3efe7;
  color: #050505;
  border: 1px solid #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.auth-panel-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-panel-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-panel-link:hover {
  color: var(--accent-strong);
}

/* Модалка экспорта / сохранения */
.export-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-actions .auth-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.export-cancel-btn {
  width: 100%;
  height: 34px;
  margin-top: 4px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.export-cancel-btn:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

