/* --- Секция загрузки видео и субтитров --- */
.upload-section {
  background: #ffffff;
  padding: 30px 25px;
  border-radius: 14px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
  max-width: 720px;
  margin: 0 auto 40px auto;
  font-size: 16px;
  color: #2c2c2c;
}

.upload-step {
  margin-bottom: 28px;
}

.upload-step h2 {
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 1.4rem;
  color: #222;
}

.file-label {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #0d6efd;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.file-label:hover {
  color: #084298;
}

.file-input {
  display: block;
  margin-top: 10px;
  font-size: 1rem;
  cursor: pointer;
}

/* Прогресс бар */
.progress-container {
  background: #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  height: 18px;
  margin: 15px 0 8px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #81c784);
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 12px 0 0 12px;
}

.info-text {
  font-size: 0.95rem;
  color: #444;
  min-height: 20px;
  font-style: italic;
}

/* --- Контейнер видео и стилей субтитров --- */
.video-style-wrapper {
  display: flex;
  gap: 25px;
  justify-content: center;
  max-width: 1280px;
  margin: 0 auto 40px;
  align-items: flex-start;
  flex-wrap: wrap;
}



.video-container {
  position: relative; 
  flex: 0 0 640px;
  height: 360px;
  transition: width .3s, height .3s;
}
/* портретный режим */
.video-container.portrait {
  flex: 0 0 360px;   
  height: 640px;    
}

#video {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 12px;
}

/* Субтитры на видео */
.subtitle-overlay {
  position: absolute;
  bottom: 10%;
  left: 0;
  right: 0;
  width: 100%;          
  box-sizing: border-box; 
  padding: 0 15px;

 
}
/* Редактор стиля субтитров */
.style-editor {

  max-width: 100%;
  background: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  padding: 20px;


  gap: 16px;
  font-size: 1rem;
  color: #333;
  height: 360px;
  box-sizing: border-box;
}


/* Адаптивность для style-editor: одна колонка на мобильных */
@media (max-width: 720px) {
  .style-editor {
    flex-direction: column;
    height: auto;
  }
  .style-editor > * {
    width: 100%;
  }
}

/* Подписи */
.editor-label {
  display: block;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.editor-hint {
  font-weight: 400;
  font-size: 0.85rem;
  color: #666;
  margin-top: 2px;
}

.editor-value {
  float: right;
  font-weight: 700;
  color: #222;
}

/* Элементы управления */
.color-input,
.range-input,
.select-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1.8px solid #ccc;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.color-input:hover,
.range-input:hover,
.select-input:hover {
  border-color: #0d6efd;
  cursor: pointer;
}

.range-input {
  -webkit-appearance: none;
  height: 10px;
  background: #ddd;
  border-radius: 6px;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #0d6efd;
  cursor: pointer;
  border-radius: 50%;
  border: none;
  margin-top: -5px;
  transition: background 0.3s ease;
}

.range-input::-webkit-slider-thumb:hover {
  background: #084298;
}

.select-input {
  cursor: pointer;
}

/* Кнопка сброса стиля */
.reset-button {
  width: 100%;
  padding: 10px 0;
  background: #e0e7ff;
  border: none;
  border-radius: 8px;
  color: #333;
  font-weight: 400;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.3s ease, color 0.3s ease;
}

.reset-button:hover,
.reset-button:focus {
  background: #c7d2fe;
  color: #000;
}

.subtitle-editor {
  background: #fafafa;
  border-radius: 14px;
  padding: 27px 32px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  font-size: 1.55rem;
  color: #333;
  min-height: 243px;
  flex: 1 1 380px;
  max-width: 40%;
  overflow-y: auto;
  line-height: 1.6;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.subtitle-editor:hover,
.subtitle-editor:focus-within {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  background-color: #fff;
}

.subtitle-editor--limited {
  max-width: 800px;
  margin: 27px auto;
  padding: 27px 32px;
  border-radius: 14px;
  color: #555;
  background: #f9f9f9;
  box-sizing: border-box;
  min-height: 243px;
  overflow-y: auto;
  font-style: normal;
}

.subtitle-editor em {
  color: #888;
  font-style: italic;
  user-select: none;
  font-size: 1.55rem;
}


/* --- Кнопки действий --- */
.action-buttons {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 20px 0 40px;
  flex-wrap: wrap;
}

.action-buttons button {
  min-width: 220px;
  padding: 14px 22px;
  font-size: 1.1rem;
  border-radius: 14px;
  background: #198754;
  color: #fff;
  box-shadow: 0 6px 18px rgba(25,135,84,0.5);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.action-buttons button:disabled {
  background: #b5b5b5;
  box-shadow: none;
  cursor: not-allowed;
}

.action-buttons button:hover:not(:disabled) {
  background: #145c32;
  box-shadow: 0 8px 24px rgba(20,92,50,0.7);
}

.action-buttons i {
  margin-right: 10px;
  font-size: 1.2rem;
  vertical-align: middle;
}

/* --- Видео и управление воспроизведением --- */
.controls-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.video-time-display {
  background: #e9ecef;
  border-radius: 14px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 1.3rem;
  color: #212529;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  min-width: 180px;
  text-align: center;
}

.btn-circle {
  font-size: 36px;
  padding: 20px 32px;
  border-radius: 50%;
  background: #0d6efd;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(13,110,253,0.5);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.btn-circle:hover {
  background: #084298;
  box-shadow: 0 8px 24px rgba(8,66,152,0.7);
}

#playPauseBtn::before {
  content: "\f04b";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

#playPauseBtn.pause::before {
  content: "\f04c";
}

/* --- Адаптивность на узких экранах --- */
@media (max-width: 960px) {
  .video-style-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .video-container,
  .style-editor,
  .subtitle-editor {
    width: 100% !important;
    max-width: 100% !important;
    flex: none;
    margin-bottom: 20px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 18px;
  }

  .action-buttons button {
    min-width: 100%;
  }
}

/* --- Общее для body и заголовков --- */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f2f6fb;
  margin: 0;
  padding: 20px 25px 60px;
  color: #222;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-header {
  text-align: center;
  margin-bottom: 35px;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1a1a;
}

.page-header .subtitle-desc {
  font-size: 1.1rem;
  color: #555;
  margin-top: 12px;
  font-weight: 400;
}

/* --- Подсказки и информация --- */
.help-section {
  max-width: 720px;
  margin: 40px auto 0 auto;
  background: #fff;
  padding: 30px 30px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.07);
  color: #333;
  font-size: 1rem;
  line-height: 1.6;
}

.help-section h2,
.help-section h3 {
  color: #2c2c2c;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
}

.help-section ul {
  margin-left: 18px;
  margin-bottom: 20px;
  color: #444;
}

.help-section li {
  margin-bottom: 8px;
}

.nav-back {
  margin-bottom: 20px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: #f0f0f0;
  color: #333;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
}

.btn-back i {
  font-size: 1.3rem;
  transition: transform 0.3s ease;
}

.btn-back:hover,
.btn-back:focus {
  background-color: #007bff;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,123,255,0.5);
  outline: none;
}

.btn-back:hover i,
.btn-back:focus i {
  transform: translateX(-4px);
}
.embed-result {
  border: 1px solid #d0d7de;
  background-color: #f9f9f9;
  padding: 24px 28px;
  border-radius: 10px;
  font-size: 1.4rem;
  color: #222;
  line-height: 1.6;
  margin-top: 24px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
  font-weight: 500;
}
.editor-container {
  display: flex;
  gap: 24px; /* Отступ между колонками */
  max-width: 900px; /* или другой подходящий max-width */
  margin: 27px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 20px; /* расстояние между кнопкой и таймкодом */
  min-width: 180px; /* минимальная ширина для контролов */
  align-items: center; /* центрируем элементы по горизонтали */
}

/* Сделаем subtitleEditor занимать оставшееся место */
.subtitle-editor {
  flex: 1 1 auto;
  max-width: none; /* снимаем ограничение max-width 40%, чтобы он занимал больше места */
  min-width: 0; /* чтобы flex корректно работал */
  margin: 0; /* сбрасываем марджин, т.к. задал общий для контейнера */
}

/* Можно уменьшить max-width для limited, чтобы не мешать разметке */
.subtitle-editor--limited {
  max-width: none;
  background: #f9f9f9;
}

.notice-box {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}
.translate-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background-color: transparent;
  color: #4a90e2;
  text-decoration: underline;
  border-radius: 0;
  font-weight: normal;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.95rem;
  box-shadow: none;
  transition: color 0.2s ease;
  user-select: none;
}

.translate-link:hover {
  color: #357abd;
  text-decoration: none;
}
.translate-link i {
  font-size: 1.75rem;
  line-height: 1;
}

.centered-info {
  text-align: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1rem;

  max-width: 480px;
  margin: 20px auto;
  line-height: 1.5;
}

.centered-info i {
  vertical-align: middle;

  margin: 0 6px;
  transition: transform 0.3s ease;
}

.warning-icon {
  font-size: 1.3em;
  color: #f44336; 
}

.rocket-icon {
  font-size: 1.2em;
  color: #4caf50;
}

.language-icon {
  font-size: 1.5em; 
  color: #2196f3;
  margin-right: 8px;
}

.highlight-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.highlight-link:hover,
.highlight-link:focus {
  color: #0056b3;
  border-color: #0056b3;
  outline: none;
  cursor: pointer;
}

.translate-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 1.05rem;
}

.centered-info i:hover {
  transform: scale(1.2);
}



.video-slider-wrapper {
  width: 640px;
  margin: 8px auto 8px auto; /* центрируем по горизонтали */
  padding: 0;
}

.video-slider {
  width: 100%;
  height: 30px; /* увеличили высоту */
  border-radius: 6px;
  background-color: #ddd;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

/* Для Chrome, Safari, Edge */
.video-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #333;
  cursor: pointer;
  margin-top: -2px; /* выравниваем по центру полосы */
}

/* Для Firefox */
.video-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #333;
  cursor: pointer;
}

/* Общие стили для мобильных устройств */
@media (max-width: 768px) {

  body {
    font-size: 16px;
    padding: 0 10px;
  }

  .header-center,
  .nav-back,
  .page-header {
    text-align: center;
  }

  .nav-back {
    margin-top: 10px;
  }

  .nav-back .btn-back {
    display: inline-block;
    font-size: 1rem;
    padding: 8px 12px;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .page-header p.subtitle-desc {
    font-size: 0.95rem;
  }

  .video-style-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .video-container {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  #video {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .style-editor {
    width: 100%;
    height: auto;
    padding: 16px;
    font-size: 0.95rem;
  }

  .subtitle-editor--limited {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    font-size: 1.2rem;
  }

  .video-slider-wrapper {
    padding: 0 10px;
  }

  .controls-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
  }

  .action-buttons button {
    width: 100%;
    max-width: 90%;
    font-size: 1rem;
  }

  .help-section {
    padding: 0 10px;
  }

  .centered-info {
    text-align: center;
    font-size: 0.95rem;
  }
}
/* Корректируем ширину ползунка и редактора на мобильных */
@media (max-width: 960px) {
  /* Убираем фиксированную ширину контейнера ползунка */
  .video-slider-wrapper {
    width: 100% !important;
    margin: 8px auto;
    padding: 0 10px;
  }
  /* Ползунок растягиваем по ширине родителя */
  .video-slider {
    width: 100% !important;
  }

  /* На мобильных пусть редактор субтитров и контролы идут в колонку */
  .editor-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  /* Редактор субтитров во всю ширину */
  .subtitle-editor,
  .subtitle-editor--limited {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px;
    font-size: 1.2rem;
  }

  /* Контейнер с кнопками управления видео */
  .controls-section {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
}
@media (max-width: 960px) {
  /* уже есть flex-direction: column для .video-style-wrapper */
  .video-style-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* Стили для панели редактирования стиля: пусть будет первой */
  .style-editor {
    order: -1;
    width: 100% !important;
    margin-bottom: 20px;
  }

  /* Видео после панели */
  .video-container {
    order: 0;
    width: 100% !important;
    height: auto;
    aspect-ratio: 16 / 9;
    margin-bottom: 20px;
  }
}
.subs-timeline-wrapper {
  margin: 14px auto 10px;
  text-align: center;
  user-select: none;
}
#subsTimeline {
  cursor: pointer;
  border: 1.5px solid #bbb;
  border-radius: 12px;
  transition: box-shadow .15s;
  box-shadow: 0 1px 12px #0001;
}
#subsTimeline:active { box-shadow: 0 0 0 3px #abd4ff88; }

@media (max-width:700px) {
  .subs-timeline-wrapper,
  .subs-timeline-wrapper > div,
  .subs-timeline-wrapper canvas {
    max-width: 100vw!important;
    min-width: 0;
    width: 100vw!important;
    height: 75px!important;
    max-height:80px;
    touch-action: pan-x; /* чтобы можно было свайпать */
  }
}
@media (max-width:440px) {
  .subs-timeline-wrapper canvas {
    height: 58px!important;
    max-height:66px;
  }
}
.subs-timeline-wrapper {
  margin: 8px auto 8px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}
#subsTimeline {
  width: 100%;
  height: 150px;
  max-width:1700px;
  background: #23252618;
  border-radius: 10px;
  border: 1.5px solid #bbb;
  display: block;
  box-shadow: 0 1px 12px #0001;
  transition: box-shadow .15s;
}
@media (max-width:1000px){
  #subsTimeline { height: 90px;}
}

/* --- Polished editor layout --- */
:root {
  --editor-primary: #2f78a7;
  --editor-primary-dark: #1f5f87;
  --editor-accent: #be5a41;
  --editor-bg: #f4f9fc;
  --editor-card: #ffffff;
  --editor-border: #dbeaf2;
  --editor-text: #1f3342;
  --editor-muted: #63798a;
  --editor-shadow: 0 18px 44px rgba(31, 75, 103, 0.12);
}

body {
  background:
    radial-gradient(circle at top left, rgba(47, 120, 167, 0.13), transparent 34rem),
    linear-gradient(180deg, #f7fbfd 0%, var(--editor-bg) 100%);
  color: var(--editor-text);
}

.header-center {
  text-align: center;
  margin: 12px auto 8px;
}

.logo-img {
  max-width: 190px;
  height: auto;
}

.nav-back {
  max-width: 1180px;
  margin: 8px auto 0;
}

.btn-back,
.language-switch {
  border: 1px solid var(--editor-border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
}

.btn-back {
  color: var(--editor-primary-dark);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(47, 120, 167, 0.1);
}

.btn-back:hover,
.btn-back:focus {
  background: var(--editor-primary);
  box-shadow: 0 12px 28px rgba(47, 120, 167, 0.26);
}

.language-switch {
  position: absolute;
  top: 24px;
  right: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--editor-primary-dark);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(31, 75, 103, 0.08);
}

.language-switch i {
  margin-right: 0;
}

.language-switch:hover,
.language-switch:focus {
  color: #ffffff;
  background: var(--editor-primary);
  outline: none;
}

.page-header {
  max-width: 900px;
  margin: 28px auto 30px;
  padding: 10px 18px;
}

.page-header h1 {
  margin: 0;
  color: var(--editor-primary-dark);
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: -0.03em;
}

.page-header .subtitle-desc {
  color: var(--editor-muted);
  font-size: clamp(16px, 2vw, 19px);
}

.main-container {
  max-width: 1320px;
  margin: 0 auto;
}

.upload-section {
  max-width: 1180px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.upload-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.upload-block {
  position: relative;
  overflow: hidden;
  background: var(--editor-card);
  padding: 26px;
  border: 1px solid var(--editor-border);
  border-radius: 24px;
  box-shadow: var(--editor-shadow);
}

.upload-block::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--editor-primary), #56b6c9, var(--editor-accent));
}

.upload-block--ready {
  border-color: #8fd2ae;
  box-shadow: 0 18px 44px rgba(39, 148, 102, 0.16);
}

.upload-block--ready::before {
  background: linear-gradient(90deg, #279466, #69c891);
}

.upload-block--ready::after {
  content: "Выбрано";
  position: absolute;
  top: 16px;
  right: 18px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e8f8ef;
  color: #1f7a50;
  font-size: 12px;
  font-weight: 800;
}

html[lang="en"] .upload-block--ready::after {
  content: "Selected";
}

.upload-block h2 {
  margin: 0 0 14px;
  color: var(--editor-primary-dark);
  font-size: 20px;
  line-height: 1.25;
}

.upload-step {
  margin-bottom: 22px;
}

.upload-step:last-child {
  margin-bottom: 0;
}

.file-label {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  padding: 16px 18px;
  border: 1.5px dashed rgba(47, 120, 167, 0.38);
  border-radius: 18px;
  background: #f3fafd;
  color: var(--editor-primary-dark);
  text-align: center;
}

.file-label:hover,
.file-label:focus-within {
  color: var(--editor-primary-dark);
  border-color: var(--editor-primary);
  background: #e9f6fb;
}

.file-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--editor-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--editor-muted);
}

#generatedSubtitleSelect,
#userVideoSelect {
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1.5px solid var(--editor-border);
  border-radius: 14px;
  background: #ffffff;
  color: var(--editor-text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#generatedSubtitleSelect:focus,
#userVideoSelect:focus {
  border-color: var(--editor-primary);
  box-shadow: 0 0 0 4px rgba(47, 120, 167, 0.13);
}

#generatedSubtitleLoadBtn,
#userVideoLoadBtn {
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--editor-primary), #48a6bd);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(47, 120, 167, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

#generatedSubtitleLoadBtn:hover:not(:disabled),
#userVideoLoadBtn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(47, 120, 167, 0.3);
}

#generatedSubtitleLoadBtn:disabled,
#userVideoLoadBtn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--editor-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--editor-border);
}

.divider span {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef7fb;
}

.centered-info,
.info-text,
.select-reminder {
  color: var(--editor-muted);
}

.selected-video-info,
#generatedSubtitleInfo {
  margin-top: 10px;
  line-height: 1.45;
}

.upload-block--ready .selected-video-info,
.upload-block--ready #generatedSubtitleInfo {
  padding: 10px 12px;
  border: 1px solid #bce7cd;
  border-radius: 12px;
  background: #f0fbf4;
  color: #1f7a50;
  font-style: normal;
}

.auto-load-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 18px 20px;
  border: 1px solid #a6ddb9;
  border-radius: 20px;
  background: linear-gradient(135deg, #f0fbf4, #ffffff);
  color: #1f6f49;
  box-shadow: 0 14px 34px rgba(39, 148, 102, 0.14);
}

.auto-load-notice i {
  margin-top: 2px;
  color: #279466;
  font-size: 24px;
}

.auto-load-notice strong {
  color: #155f3c;
}

.centered-info {
  margin: 18px auto 0;
  padding: 14px 16px;
  border: 1px solid #f3dfbd;
  border-radius: 16px;
  background: #fff9ef;
  font-size: 0.95rem;
  line-height: 1.6;
}

.warning-icon,
.rocket-icon,
.language-icon {
  margin: 0 5px;
}

.warning-icon {
  color: #d88916;
}

.rocket-icon {
  color: #289b65;
}

.language-icon {
  color: var(--editor-primary);
}

.video-style-wrapper {
  max-width: 1180px;
  margin-top: 34px;
  padding: 24px;
  border: 1px solid var(--editor-border);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--editor-shadow);
}

.video-container {
  overflow: hidden;
  border-radius: 22px;
  background: #0d1820;
  box-shadow: 0 18px 38px rgba(13, 24, 32, 0.24);
}

#video {
  border-radius: 22px;
}

.style-editor {
  width: min(100%, 360px);
  height: auto;
  border: 1px solid var(--editor-border);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(31, 75, 103, 0.1);
}

.editor-section {
  margin-top: 14px;
}

.editor-label {
  color: var(--editor-primary-dark);
}

.color-input,
.range-input,
.select-input {
  border-color: var(--editor-border);
}

.reset-button {
  background: #eef7fb;
  color: var(--editor-primary-dark);
  font-weight: 800;
}

.reset-button:hover,
.reset-button:focus {
  background: var(--editor-primary);
  color: #ffffff;
}

.video-slider-wrapper {
  width: min(100%, 680px);
}

.video-slider {
  height: 12px;
  background: #d8e8f0;
}

.video-slider::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: 0;
  background: var(--editor-primary);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 12px rgba(47, 120, 167, 0.35);
}

.video-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--editor-primary);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 12px rgba(47, 120, 167, 0.35);
}

.editor-container {
  max-width: 1040px;
  align-items: stretch;
}

.controls-section {
  min-width: 210px;
  padding: 18px;
  border: 1px solid var(--editor-border);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(31, 75, 103, 0.08);
}

.btn-circle {
  width: 78px;
  height: 78px;
  padding: 0;
  background: linear-gradient(135deg, var(--editor-primary), #48a6bd);
  box-shadow: 0 14px 28px rgba(47, 120, 167, 0.28);
}

.btn-circle:hover {
  background: linear-gradient(135deg, var(--editor-primary-dark), var(--editor-primary));
  box-shadow: 0 18px 34px rgba(47, 120, 167, 0.34);
}

.video-time-display {
  width: 100%;
  box-sizing: border-box;
  background: #eef7fb;
  color: var(--editor-primary-dark);
  box-shadow: none;
}

.subtitle-editor,
.subtitle-editor--limited {
  border: 1px solid var(--editor-border);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(31, 75, 103, 0.1);
}

.action-buttons button {
  border: 0;
  background: linear-gradient(135deg, #279466, #45b982);
  font-weight: 800;
}

.action-buttons button:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e7953, #279466);
}

.action-buttons button:disabled {
  background: #b9c6ce;
  color: #eef3f6;
}

.embed-result,
.help-section {
  max-width: 1040px;
  border: 1px solid var(--editor-border);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(31, 75, 103, 0.08);
}

@media (max-width: 900px) {
  .language-switch {
    position: static;
    justify-content: center;
    width: fit-content;
    margin: 12px auto;
  }

  .upload-columns {
    grid-template-columns: 1fr;
  }

  .upload-block {
    padding: 22px;
  }

  .video-style-wrapper {
    padding: 16px;
  }

  .controls-section {
    width: auto;
  }
}

@media (max-width: 520px) {
  body {
    padding: 0 12px 44px;
  }

  .page-header {
    margin-top: 18px;
  }

  .upload-block,
  .video-style-wrapper,
  .style-editor,
  .controls-section,
  .subtitle-editor,
  .embed-result,
  .help-section {
    border-radius: 18px;
  }

  .file-label {
    padding: 14px;
    font-size: 1rem;
  }
}

/* === Улучшенная панель редактирования субтитров === */
.editor-container {
  max-width: 1180px;
  margin: 22px auto 28px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  align-items: stretch;
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  padding: 20px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f4fafd 100%);
  border: 1px solid var(--editor-border);
  box-shadow: 0 12px 28px rgba(31, 75, 103, 0.10);
  min-width: 0;
}

.controls-section .btn-circle {
  align-self: center;
  width: 74px;
  height: 74px;
}

.video-time-display {
  font-family: "JetBrains Mono", "Consolas", "SFMono-Regular", monospace;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  text-align: center;
  border-radius: 12px;
}

/* Навигация по субтитрам */
.sub-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: #eef7fb;
  border: 1px solid var(--editor-border);
}

.nav-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
  color: var(--editor-primary-dark);
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(31, 75, 103, 0.08);
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.nav-btn:hover:not(:disabled) {
  background: var(--editor-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(47, 120, 167, 0.30);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.sub-counter {
  font-size: 1rem;
  font-weight: 700;
  color: var(--editor-primary-dark);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sub-counter__sep {
  margin: 0 4px;
  color: var(--editor-muted);
  font-weight: 500;
}

.jump-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--editor-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--editor-primary-dark);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.jump-btn:hover:not(:disabled) {
  background: var(--editor-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(47, 120, 167, 0.25);
}

.jump-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Карточка субтитра */
.subtitle-editor,
.subtitle-editor--limited {
  padding: 22px 24px;
  font-size: 1rem;
  min-height: 0;
  border-radius: 22px;
}

.subtitle-editor-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sub-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-box-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--editor-primary), #48a6bd);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 14px rgba(47, 120, 167, 0.25);
}

.sub-box-duration {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff9ef;
  border: 1px solid #f3dfbd;
  color: #8a6118;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sub-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.sub-time-field label,
.sub-text-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--editor-muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sub-time-control {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1.5px solid var(--editor-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.sub-time-control:focus-within {
  border-color: var(--editor-primary);
  box-shadow: 0 0 0 4px rgba(47, 120, 167, 0.13);
}

.sub-time-control input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 10px 12px;
  font-family: "JetBrains Mono", "Consolas", "SFMono-Regular", monospace;
  font-size: 0.98rem;
  color: var(--editor-text);
  background: transparent;
  font-variant-numeric: tabular-nums;
}

.time-set-btn {
  flex: 0 0 auto;
  border: 0;
  border-left: 1px solid var(--editor-border);
  padding: 0 14px;
  background: #f3fafd;
  color: var(--editor-primary-dark);
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.18s ease, color 0.18s ease;
}

.time-set-btn:hover {
  background: var(--editor-primary);
  color: #fff;
}

.sub-text-field textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 90px;
  padding: 12px 14px;
  border: 1.5px solid var(--editor-border);
  border-radius: 12px;
  background: #fff;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--editor-text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.sub-text-field textarea:focus {
  outline: none;
  border-color: var(--editor-primary);
  box-shadow: 0 0 0 4px rgba(47, 120, 167, 0.13);
}

/* Адаптив для редактора */
@media (max-width: 960px) {
  .editor-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .controls-section {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }
  .controls-section .btn-circle {
    align-self: auto;
    width: 64px;
    height: 64px;
  }
  .video-time-display {
    flex: 1 1 160px;
  }
  .sub-nav {
    flex: 1 1 200px;
  }
  .jump-btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 520px) {
  .sub-time-row {
    grid-template-columns: 1fr;
  }
  .subtitle-editor,
  .subtitle-editor--limited {
    padding: 18px;
  }
}

/* === Плавающий мини-плеер === */
.floating-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  z-index: 3;
  backdrop-filter: blur(6px);
  transition: background 0.18s ease, transform 0.18s ease;
}

.floating-close-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.08);
}

.video-container.is-floating {
  position: fixed !important;
  bottom: 22px;
  right: 22px;
  width: 320px;
  height: 180px;
  flex: none !important;
  z-index: 9999;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 20px 50px rgba(13, 24, 32, 0.45);
  animation: floatIn 0.25s ease;
}

.video-container.is-floating.portrait {
  width: 200px;
  height: 356px;
}

.video-container.is-floating #video {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: contain;
  background: #000;
}

.video-container.is-floating .floating-close-btn {
  display: inline-flex;
}

/* В мини-плеере размер и позицию субтитров пересчитывает JS (по новому clientWidth);
   добавляем только тень для читаемости на маленьком кадре */
.video-container.is-floating .subtitle-overlay {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* На мобильных не плаваем — мешает */
@media (max-width: 720px) {
  .video-container.is-floating {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    bottom: auto;
    right: auto;
    border: none;
    box-shadow: none;
    border-radius: 22px;
    animation: none;
  }
  .video-container.is-floating .floating-close-btn { display: none; }
}
