:root {
  --bg-base: #070707;
  --bg-surface: #101010;
  --bg-card: rgba(18, 18, 18, 0.78);
  --bg-card-hover: rgba(26, 26, 26, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(241, 38, 23, 0.5);

  --accent-red: #F12617;
  --accent-red-hover: #D81C0E;
  --accent-red-glow: rgba(241, 38, 23, 0.35);

  --text-main: #F4F1EB;
  --text-muted: #9D9991;
  --text-dim: #605E59;

  --success-color: #2ECC71;
  --warning-color: #E67E22;

  --font-heading: 'Unbounded', system-ui, -apple-system, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;

  --header-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}

/* Фоновые атмосферные свечения */
.ambient-glow {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
}

.glow-red {
  top: -100px;
  right: -50px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(241, 38, 23, 0.12) 0%, transparent 70%);
}

.glow-subtle {
  bottom: 50px;
  left: -150px;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
}

.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* Шапка приложения */
.app-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: rgba(7, 7, 7, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  margin: 0 -20px 24px;
  padding: 0 24px;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: #141414;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -1px;
}

.brand-logo .v { color: #FFFFFF; }
.brand-logo .k { color: var(--accent-red); margin-left: 1px; }

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #E67E22;
  transition: background 0.3s;
}

.system-status.online .status-dot {
  background: var(--success-color);
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.icon-button {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-button:active {
  transform: scale(0.94);
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* Пошаговая навигация (Wizard Steps) */
.steps-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 12px 20px;
  margin-bottom: 32px;
  backdrop-filter: blur(16px);
  user-select: none;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.45;
  transition: all 0.3s ease;
  cursor: pointer;
}

.step-item:hover {
  opacity: 0.8;
}

.step-item.active {
  opacity: 1;
}

.step-item.completed {
  opacity: 0.85;
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s;
}

.step-item.active .step-num {
  background: var(--accent-red);
  color: #FFFFFF;
  border-color: var(--accent-red);
  box-shadow: 0 0 16px var(--accent-red-glow);
}

.step-item.completed .step-num {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

.step-meta {
  display: flex;
  flex-direction: column;
}

.step-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

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

.step-separator {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  margin: 0 16px;
}

/* Панели шагов */
.wizard-panel {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.wizard-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-hero {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 36px;
}

.panel-hero-split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 400;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Кнопки в стиле VadimKtv / iOS */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 28px;
  background: var(--accent-red);
  color: #FFFFFF;
  border: none;
  border-radius: 9999px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-red-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-primary:hover {
  background: var(--accent-red-hover);
  box-shadow: 0 6px 24px rgba(241, 38, 23, 0.5);
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  text-decoration: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-secondary:active {
  transform: scale(0.96);
}

.btn-secondary.danger {
  color: #FF5A5A;
  border-color: rgba(255, 90, 90, 0.25);
}

.btn-secondary.danger:hover {
  background: rgba(255, 90, 90, 0.08);
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--accent-red);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.btn-text-action:active {
  opacity: 0.8;
}

/* Сетка платформ */
.platforms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.platform-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  backdrop-filter: blur(12px);
}

.platform-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.platform-card:active {
  transform: scale(0.98);
}

.platform-card.selected {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 1px var(--accent-red), 0 8px 30px rgba(241, 38, 23, 0.15);
}

.platform-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Верхняя строка карточки: иконка слева, статус и галочка справа */
.platform-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.platform-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-badge,
.platform-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  box-sizing: border-box;
  white-space: nowrap;
}

.platform-badge-active {
  background: rgba(46, 204, 113, 0.1);
  border-color: rgba(46, 204, 113, 0.25);
  color: var(--success-color);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.platform-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.platform-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.platform-name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.platform-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Индикатор выбора карточки (круглый чекбокс в верхнем правом углу) */
.platform-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  flex-shrink: 0;
}

.platform-check svg {
  width: 13px;
  height: 13px;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  stroke: #ffffff;
}

.platform-card.selected .platform-check {
  background: var(--accent-red);
  border-color: var(--accent-red);
  box-shadow: 0 2px 10px rgba(241, 38, 23, 0.45);
}

.platform-card.selected .platform-check svg {
  opacity: 1;
  transform: scale(1);
}

.platform-card.disabled .platform-check {
  display: none;
}

/* Действия внутри карточки (аккуратный вертикальный стек) */
.platform-actions {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.platform-actions .btn-primary,
.platform-actions .btn-secondary {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  text-align: center;
  box-sizing: border-box;
}

/* Нижние блоки действий */
.panel-footer {
  display: flex;
  justify-content: center;
  padding-top: 12px;
}

.panel-footer-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 24px;
}

/* Панель поиска и выбора треков (Шаг 2) */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 10px 16px;
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  color: var(--text-muted);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
}

.clear-search {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.custom-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox-label input {
  display: none;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.custom-checkbox-label input:checked + .custom-checkbox {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

.custom-checkbox-label input:checked + .custom-checkbox::after {
  content: '✓';
  color: #FFF;
  font-size: 11px;
  font-weight: 800;
}

.checkbox-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* Список треков */
.tracks-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  overflow: hidden;
  max-height: 520px;
  display: flex;
  flex-direction: column;
}

.tracks-list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: transparent;
  transition: background 0.15s;
  user-select: none;
}

.track-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.track-check {
  display: flex;
  align-items: center;
}

.track-cover {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #1C1C1C;
  object-fit: cover;
  flex-shrink: 0;
}

.track-cover-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #181818;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
}

.track-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.track-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-duration {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Карточка настроек переноса (Шаг 3) */
.transfer-options-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  height: 46px;
  background: #141414;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0 16px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent-red);
}

.segmented-control {
  display: inline-flex;
  background: #141414;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 3px;
  gap: 4px;
}

.segmented-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.segmented-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* Прогресс-бар и мониторинг (Шаг 4) */
.progress-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 32px 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(20px);
}

.progress-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-box.success .stat-number { color: var(--success-color); }
.stat-box.warning .stat-number { color: var(--warning-color); }

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #F12617 0%, #FF5A45 100%);
  border-radius: 9999px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px var(--accent-red-glow);
}

.progress-percentage-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.progress-percent {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
}

.current-track-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(241, 38, 23, 0.08);
  border: 1px solid rgba(241, 38, 23, 0.2);
  border-radius: 16px;
  padding: 14px 18px;
}

.track-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 16px var(--accent-red); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.current-track-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.current-track-label {
  font-size: 11px;
  color: var(--accent-red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.current-track-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Созданный плейлист */
.playlist-created-card {
  margin-top: 18px;
  padding: 18px;
  background: rgba(46, 204, 113, 0.08);
  border: 1px solid rgba(46, 204, 113, 0.25);
  border-radius: 16px;
}

.playlist-card-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.playlist-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(46, 204, 113, 0.15);
  color: var(--success-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.playlist-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.playlist-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
}

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

.sync-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* Лента сопоставления */
.recent-results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
}

.results-stream {
  margin-top: 16px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  font-size: 13px;
}

.result-track-source {
  color: var(--text-main);
  font-weight: 500;
}

.result-badge {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.result-badge.matched {
  background: rgba(46, 204, 113, 0.1);
  color: var(--success-color);
  border: 1px solid rgba(46, 204, 113, 0.25);
}

.result-badge.failed {
  background: rgba(230, 126, 34, 0.1);
  color: var(--warning-color);
  border: 1px solid rgba(230, 126, 34, 0.25);
}

/* Выпадающее меню экспорта */
.dropdown-wrapper {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #181818;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
  padding: 6px;
  min-width: 200px;
  z-index: 50;
  backdrop-filter: blur(20px);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 10px 14px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Модальное окно */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  background: #121212;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.auth-steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-step-row {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-step-row strong {
  color: var(--text-main);
}

.auth-step-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #FFF;
  flex-shrink: 0;
}

.form-textarea {
  width: 100%;
  background: #181818;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  color: var(--text-main);
  font-family: monospace;
  font-size: 12px;
  outline: none;
  resize: vertical;
}

.form-textarea:focus {
  border-color: var(--accent-red);
}

.auth-error {
  color: #FF5A5A;
  font-size: 12px;
  margin-top: 10px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-muted);
}

/* Telegram Transfer Card & Callouts */
.telegram-meta-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.meta-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.meta-item-label {
  color: var(--text-muted);
}

.meta-item-value {
  color: var(--text-main);
  font-weight: 600;
  font-family: var(--font-heading);
  font-size: 12px;
}

.info-callout {
  background: rgba(42, 171, 238, 0.06);
  border: 1px solid rgba(42, 171, 238, 0.2);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}

.info-callout p {
  margin: 0;
}

.info-callout strong {
  color: #2AABEE;
  font-weight: 600;
}

/* Статус-пилюли в шапке */
.status-pills-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  transition: all 0.25s;
}

.status-pill.online {
  background: rgba(46, 204, 113, 0.08);
  border-color: rgba(46, 204, 113, 0.25);
  color: var(--success-color);
}

.status-pill.telegram-active {
  background: rgba(42, 171, 238, 0.08);
  border-color: rgba(42, 171, 238, 0.25);
  color: #2AABEE;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #E67E22;
}

.status-pill.online .pill-dot {
  background: var(--success-color);
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.5);
}

.status-pill.telegram-active .pill-dot {
  background: #2AABEE;
  box-shadow: 0 0 6px rgba(42, 171, 238, 0.5);
}

.btn-header-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-header-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Быстрые пресеты выбора (Шаг 2) */
.selection-presets-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.presets-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.presets-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.chip-btn {
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.chip-btn.active {
  background: rgba(241, 38, 23, 0.15);
  border-color: var(--accent-red);
  color: #FFFFFF;
}

.chip-btn.clear {
  color: #FF5A5A;
  border-color: rgba(255, 90, 90, 0.2);
}

.chip-btn.clear:hover {
  background: rgba(255, 90, 90, 0.1);
}

.sort-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 4px 12px;
  color: var(--text-muted);
}

.sort-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.sort-select option {
  background: #141414;
  color: #FFFFFF;
}

/* Кнопка воспроизведения трека в списке */
.btn-track-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-right: 4px;
}

.btn-track-play:hover {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #FFFFFF;
  transform: scale(1.06);
}

.btn-track-play.playing {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #FFFFFF;
}

/* Действия после завершения переноса (Шаг 4) */
.completed-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.completed-actions-row .btn-primary {
  height: 48px;
  padding: 0 24px;
}

.btn-secondary.warning {
  color: #F39C12;
  border-color: rgba(243, 156, 18, 0.3);
}

.btn-secondary.warning:hover {
  background: rgba(243, 156, 18, 0.1);
  border-color: rgba(243, 156, 18, 0.5);
}

/* Всплывающий мини-плеер */
.floating-mini-player {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, calc(100vw - 32px));
  background: rgba(18, 18, 18, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 999;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.mini-player-track {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.mini-player-cover-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  overflow: hidden;
  background: #222;
  flex-shrink: 0;
}

.mini-player-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-player-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.mini-player-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-artist {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mini-player-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-red);
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.mini-player-btn:active {
  transform: scale(0.92);
}

.mini-player-btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}

.mini-player-btn-close:hover {
  color: var(--text-main);
}

/* Модалки ненайденных и истории */
.modal-card.wide {
  max-width: 680px;
}

.unmatched-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  margin-top: 14px;
}

.unmatched-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  gap: 12px;
}

.unmatched-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.unmatched-search-btn {
  font-size: 12px;
  color: var(--accent-red);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(241, 38, 23, 0.3);
  border-radius: 9999px;
  white-space: nowrap;
  transition: all 0.2s;
}

.unmatched-search-btn:hover {
  background: rgba(241, 38, 23, 0.1);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  gap: 16px;
}

.history-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item-target {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.history-item-date {
  font-size: 12px;
  color: var(--text-muted);
}

.history-item-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.history-stat-tag {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.history-stat-tag.success {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success-color);
}

/* Адаптив для мобильных устройств (iOS 375px+) */
@media (max-width: 768px) {
  .app-layout {
    padding: 0 16px 24px;
  }
  .app-header {
    padding: 0 16px;
    margin: 0 -16px 16px;
  }
  .steps-nav {
    padding: 10px 14px;
  }
  .step-meta {
    display: none;
  }
  .step-separator {
    margin: 0 8px;
  }
  .panel-hero-split {
    flex-direction: column;
    align-items: flex-start;
  }
  .progress-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Вкладки внутри модального окна */
.modal-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border-subtle);
}

.modal-tab-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.modal-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.modal-tab-pane {
  display: block;
}

.modal-tab-pane.hidden {
  display: none;
}

/* Кнопка официального входа Яндекс ID */
.btn-yandex-id {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: #FC3F1D;
  color: #FFFFFF;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(252, 63, 29, 0.3);
}

.btn-yandex-id:hover {
  background: #E03517;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(252, 63, 29, 0.4);
}

.yandex-badge-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FC3F1D;
  font-weight: 900;
  font-size: 15px;
  line-height: 1;
}

/* Состояние пустой библиотеки на шаге 2 */
.empty-library-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 50px 24px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: 20px;
  margin: 16px 0;
}

.empty-library-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: rgba(252, 63, 29, 0.08);
  border: 1px solid rgba(252, 63, 29, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: #FC3F1D;
}

.empty-library-title {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.empty-library-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.empty-library-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
