@font-face {
  font-family: 'Helvetica';
  src: url('fonts/helvetica_regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Helvetica';
  src: url('fonts/helvetica_cyr_oblique.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
}

@font-face {
  font-family: 'Inter-SemiBold';
  src: url('fonts/Inter-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
}

@font-face {
  font-family: 'Inter-Medium';
  src: url('fonts/Inter-Medium.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-cyrillic-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'Roboto';
  src: url('fonts/roboto-cyrillic-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}

@font-face {
  font-family: 'Roboto';
  src: url('fonts/roboto-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root{
  --bg: #08080b;
  --surface: #121418;
  --surface-2: #181b20;
  --text: #E7E5E0;
  --muted: #8B8F98;
  --accent: #FFFFFF;
  --accent-orange: #f0c528;
  --accent-red: #ea4444;
  --accent-orange-hover: #e5aa1c; /* наведение: темнее и ближе к оранжевому */
  /* Объём даёт полупрозрачная накладка поверх плоской заливки, а не переход цвета */
  --btn-sheen: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 42%, rgba(0,0,0,0.085) 100%);
  /* На тёмных плашках та же накладка, но втрое слабее, иначе замыливает */
  --panel-sheen: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.06) 100%);
  --panel-edge-light: inset 0 1px 0 rgba(255,255,255,0.03);
  --btn-edge: 1px solid rgba(255,240,190,0.30);
  --btn-shadow: inset 0 1px 0 rgba(255,250,225,0.26);
  --btn-shadow-hover: inset 0 1px 0 rgba(255,252,235,0.34);
  --btn-grey: #22262c;
  --btn-grey-hover: #1c2025;
  --radius: 12px;
}

/* ---------- Заглушка для телефонов/планшетов ---------- */
.mobile-blocker{
  display:none;
  position: fixed; inset:0; z-index: 9999;
  flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding: 32px;
  background: var(--bg); color: var(--text);
}
html.device-blocked .mobile-blocker{ display:flex; }
html.device-blocked #drop-view,
html.device-blocked #player-view{ display:none !important; }
.mb-icon{ width:56px; height:56px; color: var(--muted); margin-bottom:20px; }
.mb-title{ font-size: 24px; margin-bottom: 12px; }
.mb-text{ max-width: 360px; font-size: 14px; line-height:1.5; color: var(--muted); }

::selection {
  background: #3a3a3a;
  color: #d0d0d0;
}

*{ box-sizing: border-box; }
html, body{
  margin:0; height:100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter-Medium', sans-serif;
  font-weight: 300;
  display:flex; flex-direction:column;
  overflow: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #3a3f46 transparent;
}

/* Глобальный скроллбар в цвет сайта */
::-webkit-scrollbar{
  width: 8px;
}
::-webkit-scrollbar-track{
  background: transparent;
  margin: 4px 0;
}
::-webkit-scrollbar-thumb{
  background-color: #3a3f46;
  border-radius: 8px;
  border: 2px solid var(--surface);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover{
  background-color: #4a4f56;
}
.title-font{ font-family:'Helvetica', sans-serif; letter-spacing: .02em; font-weight: 400; }

/* ---------- Экран выбора файла ---------- */
#drop-view{
  flex: 1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding: 28px 20px;
}
#drop-view h1{
  font-size: 46px; font-weight: 400; margin: 0 0 26px; text-align:center;
  color: var(--text);
}
/* Элементы главной поднимаются один за другим при открытии страницы */
@keyframes rise-in{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference){
  #drop-view > h1, #drop-view > .resume-panel, #drop-view > .dropzone-group, #drop-view > .url-input-container{
    animation: rise-in .45s cubic-bezier(.2,.7,.2,1) both;
  }
  #drop-view > .resume-panel{ animation-delay: .05s; }
  #drop-view > .dropzone-group{ animation-delay: .1s; }
  #drop-view > .url-input-container{ animation-delay: .16s; }
  .resume-panel:not(.show){ animation: none; }
}

.dropzone-group{
  width: min(640px, 90vw);
  display: flex;
  gap: 16px;
}
.dropzone{
  flex: 1 1 0;
  min-width: 0;
  min-height: 280px;
  border: 2px dashed #33383f;
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: var(--panel-sheen);
  box-shadow: var(--panel-edge-light);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap: 14px;
  cursor: pointer;
  transition: border-color .3s ease, background-color .2s ease, box-shadow .2s ease;
  text-align:center;
  padding: 30px;
}
.dropzone:hover{
  border-color: #8B8F98;
  background-color: #16191f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.dropzone.dragover{
  border-color: #8B8F98;
  background-color: #16191f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.dropzone svg{
  width: 40px;
  height: 40px;
  stroke: var(--accent);
  transition: transform .3s ease;
  /* У иконок внизу пустое поле внутри квадрата, съедаем его: от глифа до текста те же 14px, что от текста до подписи */
  margin-bottom: -5px;
}
#dropzone-folder svg{ margin-bottom: -8px; }
.dropzone .main-txt{
  font-family:'Helvetica', sans-serif;
  letter-spacing: .02em;
  font-size: 19px;
  font-weight: 300;
  transition: transform .3s ease;
}
.dropzone .sub-txt{
  color: var(--muted);
  font-size: 13px;
  transition: transform .3s ease;
}
.dropzone:hover svg{
  transform: scale(1.02);
}
.dropzone:hover .main-txt{
  transform: scale(1.02);
}
.dropzone:hover .sub-txt{
  transform: scale(1.02);
}
.dropzone.dragover svg{
  transform: scale(1.02);
}
.dropzone.dragover .main-txt{
  transform: scale(1.02);
}
.dropzone.dragover .sub-txt{
  transform: scale(1.02);
}
.dropzone .sub-txt code{ background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-family:'JetBrains Mono', monospace; }

.url-input-container{
  width: min(640px, 90vw);
  margin-top: 16px;
  display:flex; flex-direction:column;
  gap: 16px;
}
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

.url-input-row{
  display:flex; gap: 10px;
}

.url-input{
  flex:1;
  padding: 9px 16px;
  background: var(--surface);
  border: 1px solid #23272e;
  border-radius: var(--radius);
  color: var(--text);
  font-family:'JetBrains Mono', monospace; font-size: 13px;
  outline:none; transition: border-color .3s ease;
}
.url-input:focus{
  border-color: var(--accent);
}
.url-input::placeholder{
  color: var(--muted);
}
.url-input.error{
  border-color: var(--accent-red);
  transition: border-color .3s ease, opacity .3s ease, visibility .3s ease;
  opacity: 1;
  visibility: visible;
}

.url-load-btn{
  background-color: var(--accent-orange); background-image: var(--btn-sheen);
  border: var(--btn-edge); box-shadow: var(--btn-shadow); color: #0B0D10;
  padding: 9px 15px;
  white-space: nowrap;
  transition: background-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.url-load-btn:hover{ background-color: var(--accent-orange-hover); box-shadow: var(--btn-shadow-hover); }
.url-load-btn:active{ transform: scale(0.97); }
.url-load-btn:disabled{
  opacity: .5; cursor: not-allowed;
}
.url-loading-spinner{
  width: 16px; height: 16px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}
@keyframes spin{
  to{ transform: rotate(360deg); }
}

input[type=file]{ display:none; }

.url-hint{
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  margin-top: 6px;
  text-align: center;
  max-width: min(640px, 90vw);
}

/* ---------- Блок: расширение FetchV + предупреждение про HLS ---------- */
.hls-info-panel{
  width: min(640px, 90vw);
  display: flex;
  align-items: stretch;
  gap: 20px;
}
.hls-info-col{ flex: 1; min-width: 0; }
.hls-info-divider{
  width: 1px;
  flex-shrink: 0;
  background: #23272e;
}
.hls-info-ext{
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hls-info-header{
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}
.hls-info-icon{
  width: 18px; height: 18px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.hls-info-name{
  font-family: 'Inter-SemiBold', sans-serif;
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
}
.hls-info-desc{
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}
.hls-info-link{
  transition: color .2s ease;
  margin-left: 0;
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-orange);
  text-decoration: none;
  white-space: nowrap;
  display: block;
  width: fit-content;
  margin: 0 auto;
}
.hls-info-link:hover{
  text-decoration: underline;
  color: var(--accent-orange-hover);
}

.hls-info-warning{
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  text-align: center;
}
.hls-info-warning .hls-info-icon{
  color: var(--accent-orange);
}
.hls-info-warning .url-hint{
  margin-top: 0;
  text-align: center;
  max-width: none;
}

@media (max-width: 560px){
  .hls-info-panel{ flex-direction: column; }
  .hls-info-divider{ width: 100%; height: 1px; }
}
/* Справка про ссылки свёрнута под одну строку, раскрывается по клику */
.help-toggle{
  align-self: center;
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: -4px;
  padding: 4px 8px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  border-radius: 6px;
  transition: color .15s ease, background-color .15s ease;
}
.help-toggle:hover{ color: var(--text); background-color: var(--surface); }
.help-toggle svg{ width: 16px; height: 16px; transition: transform .2s ease; }
.help-toggle[aria-expanded="true"] svg{ transform: rotate(180deg); }
.hls-info-wrap{
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: -16px;
  transition: grid-template-rows .3s ease, opacity .25s ease, margin-top .3s ease, visibility 0s .3s;
  visibility: hidden;
}
.hls-info-wrap > .hls-info-panel{ min-height: 0; overflow: hidden; }
.hls-info-wrap.open{
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0;
  visibility: visible;
  transition: grid-template-rows .3s ease, opacity .25s ease .05s, margin-top .3s ease, visibility 0s 0s;
}

.err-msg{
  color: var(--accent-red); font-size: 13px; margin-top: 10px; font-family:'JetBrains Mono', monospace;
  min-height: 17px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.err-msg.show{
  opacity: 1;
  visibility: visible;
}

/* ---------- Панель продолжения просмотра ---------- */
.resume-panel{
  width: min(640px, 90vw);
  margin-bottom: 16px;
  background-color: var(--surface);
  background-image: var(--panel-sheen);
  box-shadow: var(--panel-edge-light);
  border: 1px solid #23272e;
  border-radius: var(--radius);
  overflow: hidden;
  opacity: 1;
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .3s ease, opacity .3s ease, margin .3s ease, border-color .3s ease;
}
.resume-panel-inner{
  min-height: 0;
  overflow: hidden;
  padding: 14px 20px;
  transition: padding .3s ease;
}
.resume-panel:not(.show){
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: 0;
  border-color: transparent;
  pointer-events: none;
}
.resume-panel:not(.show) .resume-panel-inner{
  padding-top: 0;
  padding-bottom: 0;
}
.resume-panel .os-title{ margin-bottom: 6px; }
.resume-panel .hint-sub{
  font-size: 12.5px; color: var(--muted); margin-bottom: 12px;
}

.resume-item{
  display:flex; align-items:center; justify-content: space-between; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid #20242b;
  max-height: 56px;
  opacity: 1;
  overflow: hidden;
  transition: max-height .3s ease, opacity .3s ease, padding .3s ease, border-color .3s ease;
}
.resume-item:last-child{ border-bottom: none; }
.resume-item.collapsed{
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
}
.ri-info{ min-width: 0; flex: 1; }
.ri-name{
  font-size: 14px; color: var(--text);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.ri-separator{
  margin: 0 6px;
  color: var(--muted);
}
.ri-type-badge{
  font-family:'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}
.ri-time{
  font-family:'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); margin-top: 3px;
}
.ri-actions{ display:flex; align-items:center; gap: 8px; flex-shrink:0; }
.ri-clear{
  background: transparent; padding: 3px 7px; font-size: 13px;
  color: var(--muted); border-radius: 5px; flex-shrink:0;
}
.ri-clear:hover{ color: var(--accent-red); }
.ri-continue{
  flex-shrink:0; background-color: var(--accent-orange); background-image: var(--btn-sheen);
  border: var(--btn-edge); box-shadow: var(--btn-shadow); color: #0B0D10;
  transition: background-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.ri-continue:hover{ background-color: var(--accent-orange-hover); box-shadow: var(--btn-shadow-hover); }
.ri-continue:active{ transform: scale(0.97); }
.ri-continue:disabled{ opacity: .6; cursor: default; }

.os-title{
  font-family:'JetBrains Mono', monospace; font-size: 11.5px; letter-spacing:.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
input[type=color]{
  width: 34px; height: 28px; border: 1px solid #333; border-radius: 6px;
  background: none; padding: 0; cursor: pointer;
}
.dr-panel input[type=color]{ width: 22px; height: 22px; flex-shrink:0; }
.align-grid{ display:flex; gap: 6px; }
.align-btn{
  width: 26px; height: 26px; padding: 0;
  background-color: var(--surface-2); background-image: var(--panel-sheen);
  box-shadow: var(--panel-edge-light);
  color: var(--muted);
  border-radius: 6px; display:flex; align-items:center; justify-content:center; flex-shrink:0;
  transition: background-color .2s ease;
}
.align-btn svg{ width: 15px; height: 15px; }
.align-btn:hover svg{ stroke: var(--text); }
.align-btn.active:hover svg{ stroke: var(--accent-orange); }
.align-btn.active{ background-color:#2a2f37; color: var(--accent-orange); }

.pos-layout{
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.preset-grid{
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 5px;
  width: 60px;
}
.preset-btn{
  padding: 5px;
  background-color: var(--surface-2); background-image: var(--panel-sheen);
  box-shadow: var(--panel-edge-light);
  border-radius: 6px;
  display:flex; align-items:center; justify-content:center;
  transition: background-color .2s ease;
}
.preset-btn svg{ width: 100%; height: 14px; }
.preset-btn svg rect{ fill:none; stroke: #3a3f46; stroke-width: 1; }
.preset-btn svg circle{ fill: var(--muted); }
.preset-btn:hover svg rect{ stroke: #565c66; }
.preset-btn:hover svg circle{ fill: var(--text); }
.preset-btn.active{ background-color:#2a2f37; }
.preset-btn.active svg rect{ stroke: var(--accent-orange); }
.preset-btn.active svg circle{ fill: var(--accent-orange); }

.pos-pad{
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 16 / 9;
  background: #050607;
  border: 1px solid #2a2f37;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  overflow: hidden;
  outline: none;
}
.pos-pad:focus-visible{
  box-shadow: inset 0 0 0 1px var(--accent);
}
.pos-pad-safe{
  position: absolute;
  inset: 1.5% 1.5%;
  border: 1px dashed #33383f;
  border-radius: 8px;
  pointer-events: none;
}
.pos-pad-hint{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12%;
  text-align: center;
  font-size: 11px;
  line-height: 1.4;
  color: #5b626c;
  pointer-events: none;
  user-select: none;
}
.pos-pad-handle{
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-orange);
  box-shadow: 0 0 0 4px rgba(242,194,69,.22);
  transform: translate(-50%, -50%);
  cursor: grab;
  pointer-events: none;
}
.pos-pad:active .pos-pad-handle{ cursor: grabbing; }

/* ---------- Экран плеера ---------- */
#player-view{ display:none; flex:1; flex-direction:column; }
#player-view.active{ display:flex; }

.toolbar{
  display:flex; align-items:center; justify-content: center; gap: 18px;
  padding: 40px 24px 16px; position: relative;
}
/* Серая кнопка собрана как жёлтая: та же накладка объёма и верхний блик, при наведении заливка темнее, блик ярче */
.back-btn{
  font-family: 'Inter-SemiBold', sans-serif; font-weight: 600; font-size: 12.5px; letter-spacing: 0.01em;
  padding: 7px 12px; border-radius: 6px;
  background-color: var(--btn-grey); background-image: var(--btn-sheen);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: var(--text);
  flex-shrink: 0;
  transition: background-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.back-btn:hover{ background-color: var(--btn-grey-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.back-btn:active{ transform: scale(.97); }
.player-title{
  font-size: 26px; font-weight: 400; margin: 0; text-align:center; color: var(--text);
  max-width: 60vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  cursor: default;
  position: relative;
  padding-bottom: 2px;
  user-select: none;
  min-height: 32px;
  transition: color .15s ease;
}
/* Пустому названию при редактировании нужна ширина под курсор и плейсхолдер */
.player-title.editing{ min-width: 100px; }
/* Обёртка вокруг заголовка: у него overflow:hidden ради многоточия, вложенный ::after обрезался бы */
.player-title-box{
  position: relative;
  display: inline-flex;
  min-width: 0;
}
.player-title.editing{
  white-space: pre-wrap;
  overflow: visible;
}
/* Карандаш справа от названия появляется при наведении, пока имя не редактируется */
.title-edit-icon{
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%) translateX(-4px);
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.player-title-box:has(.player-title:not(.editing):hover) .title-edit-icon{
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.player-title::before{
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--muted);
  transform: scaleX(0);
  transition: transform .15s ease;
}
.player-title:hover{
  color: var(--muted);
  cursor: pointer;
}
.player-title:hover::before{
  transform: scaleX(1);
}
.player-title.editing{
  cursor: text;
  color: var(--text);
  outline: none;
}
.player-title.editing::before{
  background: var(--accent-orange);
  transform: scaleX(1);
}
.player-title.editing:empty::before,
.player-title[data-placeholder]:empty::before{
  content: attr(data-placeholder);
  position: static;
  color: var(--muted);
  opacity: 0.5;
  background: none;
  height: auto;
  transform: none;
  white-space: nowrap;
}

button{
  font-family:'Inter-Medium', sans-serif; font-weight:300; font-size:13.5px;
  border:none; border-radius: 8px; padding: 9px 15px; cursor:pointer;
  background: var(--surface-2); color: var(--text);
  transition: transform .08s ease;
}
button.pressed{ transform: scale(.97); }

.stage{
  position: relative; flex:1; background:#000;
  display:flex; align-items:center; justify-content:center;
  margin: 0 24px 16px; border-radius: var(--radius); overflow:hidden;
  max-width: 1320px; max-height: 76vh; width: 100%;
  align-self: center;
}
video{ width:100%; height:100%; max-height: 76vh; display:block; background:#000; object-fit: contain; transition: transform .15s ease; user-select: none; }

.overlay{
  position:absolute; left: 90%; top: 88%;
  transform: translate(-90%, -88%);
  display:flex; flex-direction: column; gap: 2px;
  pointer-events: none; max-width: calc(100% - 32px);
  z-index: 2;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background .15s ease;
}
.overlay.pos-smooth{
  transition: left .12s ease-out, top .12s ease-out;
}
.overlay .ov-title{
  font-family:'JetBrains Mono', monospace; font-size: 17px; color: #FFFFFF;
  white-space: nowrap; overflow:hidden; text-overflow: ellipsis;
  /* Без ограничения ширины строка в колонке flex берёт свою ширину целиком и многоточие не срабатывает */
  max-width: 100%;
}
.overlay .ov-time{
  font-family:'JetBrains Mono', monospace; font-size: 16px; color: #FFFFFF;
  white-space: nowrap;
}

.subtitles{
  position: absolute;
  /* Значение на первую отрисовку, дальше отступ считает скрипт от высоты кадра */
  bottom: 4.25%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  text-align: center;
  pointer-events: none;
  /* Панель управления всплывает поверх субтитров, как в VLC, поэтому слой ниже неё */
  z-index: 2;
}
.subtitles span{
  display: inline-block;
  color: #ffffff;
  /* Шрифт, начертание и межстрочный интервал как у субтитров VLC */
  font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.07;
  letter-spacing: 0;
  max-width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
  vertical-align: middle;
}

.video-error{
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap: 10px; text-align:center; padding: 30px;
  background: rgba(11,13,16,.9);
  z-index: 5;
}
.video-error .ve-title{
  font-size: 18px; font-weight: 600; font-family: 'Inter-SemiBold', sans-serif; color: #E08B7D;
}
.video-error .ve-detail{
  font-family:'JetBrains Mono', monospace; font-size: 12.5px; color: var(--muted);
  max-width: 520px; line-height:1.6;
}
.video-error .ve-solution{
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(242,194,69,.1);
  border: 1px solid rgba(242,194,69,.3);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
  max-width: 520px;
}
.video-error .ve-solution strong{
  color: #F2C245;
  display: block;
  margin-bottom: 6px;
}

.buffering-overlay{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
}
.buffering-overlay.visible{
  opacity: 1;
  visibility: visible;
}
.buffering-spinner{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(231,229,224,.18);
  border-top-color: var(--text);
  animation: buffering-spin .8s linear infinite;
}
@keyframes buffering-spin{
  to{ transform: rotate(360deg); }
}

/* ---------- ПАНЕЛЬ УПРАВЛЕНИЯ ---------- */
/* В полном экране сцена занимает весь экран: оконные ограничения размера не действуют */
.stage:fullscreen, .stage:-webkit-full-screen{ margin: 0; border-radius: 0; max-width: none; max-height: none; }
/* Видео чуть уже экрана: при точном совпадении размеров движок выносит его в hardware overlay, где раскладка кадра ломается */
.stage:fullscreen video, .stage:-webkit-full-screen video{ max-height: 100vh; width: calc(100% - 1px); }

.click-catcher{ position:absolute; inset:0; z-index: 1; cursor: default; }

.controls-bar{
  position:absolute; left:0; right:0; bottom:0; z-index: 3;
  display:flex; flex-wrap: wrap; align-items:center; gap: 18px; row-gap: 8px;
  padding: 34px 18px 14px;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent);
  transition: opacity .25s ease;
}

/* Группы: между группами 18px, внутри группы зазор 4px, всё пропорционально с воздухом */
/* У треугольника плея слева пустое поле внутри иконки, поэтому зазор до времени меньше, чем от времени до таймлайна: на глаз они равны */
.playback-group{
  display:flex; align-items:center; gap: 8px;
  flex-shrink: 0;
}
.time-display{ margin-right: -1px; }
/* Кнопки справа стоят вплотную квадратами, у иконок хватает своего поля; отступ слева выравнивает зазор от ползунка громкости с остальными */
.extra-group{
  display:flex; align-items:center; gap: 4px;
  flex-shrink: 0;
  margin-left: -10px;
}
.stage.controls-hidden .controls-bar{ opacity: 0; pointer-events: none; }
.stage.controls-hidden{ cursor: none; }
.stage.controls-hidden .click-catcher{ cursor: none; }

/* Все кнопки одного размера, иконки внутри центрированы: тогда зазоры между ними одинаковые, какой бы ни была иконка */
.ctrl-btn{
  background: transparent; border:none; padding: 0; width: 34px; height: 34px; border-radius: 6px;
  color: var(--text); cursor:pointer; display:flex; align-items:center; justify-content:center;
  flex-shrink: 0;
  position: relative;
  border: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ctrl-btn:hover{ color: var(--accent); }
.ctrl-btn svg{ width: 24px; height: 24px; }
#dr-btn svg{ width: 22px; height: 22px; }
#hotkeys-btn svg{ width: 21px; height: 21px; }
.ctrl-btn:disabled{ color: var(--muted); cursor: default; opacity: .5; }

.ctrl-btn::after,
.volume-slider-wrap::after{
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface);
  border: 1px solid #23272e;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'Inter-Medium', sans-serif;
  font-weight: 300;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.ctrl-btn:hover::after,
.volume-slider-wrap.show-tooltip::after{
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Обёртка нужна ради тултипа: у самого input псевдоэлементов нет. Подсказка стоит над бегунком, координату задаёт скрипт */
.volume-slider-wrap{
  position: relative;
  display: flex;
  align-items: center;
}
.volume-slider-wrap::after{
  left: var(--tip-x, 50%);
  font-family:'JetBrains Mono', monospace;
}

/* Левая крайняя кнопка - tooltip уходит вправо */
.ctrl-btn.left-edge::after{
  left: 0;
  transform: translateY(4px);
}
.ctrl-btn.left-edge:hover::after{
  transform: translateY(0);
}

/* Правая крайняя кнопка - tooltip уходит влево */
.ctrl-btn.right-edge::after{
  left: auto;
  right: 0;
  transform: translateY(4px);
}
.ctrl-btn.right-edge:hover::after{
  transform: translateY(0);
}

/* Стрелки серий это одна пара: кнопки уже общих 34px, чтобы иконки стояли рядом, а не через квадрат воздуха.
   Отступы по краям съедают пустоту внутри иконок, чтобы от дорожки до стрелки и от стрелки до динамика было по 15px */
.playlist-nav{
  display:flex; align-items:center; gap: 0;
  margin-left: -8px; margin-right: -5px;
}
.playlist-nav .ctrl-btn{ width: 26px; }
/* У значка полного экрана viewBox обрезан по полям, поэтому он меньше соседей в пикселях, но равен им на глаз */
.ctrl-btn#fullscreen-btn svg{ width: 20px; height: 20px; }

/* Ширина по тексту: моноширинный шрифт держит её постоянной, а фиксированные 150px давали пустоту вокруг коротких таймингов */
.time-display{
  font-family:'JetBrains Mono', monospace; font-size: 12.5px; color: var(--text);
  flex-shrink:0; white-space: nowrap;
}

/* Единый вид всех ползунков: тонкая линия, заливка до бегунка, круглый бегунок */
input[type=range]{
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  background: transparent;
  cursor: pointer;
  --fill: 0%;
}
input[type=range]:disabled{
  opacity: .4;
  cursor: default;
}
input[type=range]::-webkit-slider-runnable-track{
  height: 4px;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.14);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: var(--fill) 100%;
  background-position: left center;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
}

/* Таймлайн: поверх общей заливки ещё полупрозрачный слой буфера */
/* Таймлайн живёт в обёртке: она занимает место в панели, ползунок растянут на неё, под ним отметки блюра */
.seek-wrap{
  position: relative;
  flex: 1 1 140px;
  min-width: 60px;
  display: flex;
  align-items: center;
}
#seek{
  width: 100%;
  position: relative;
  z-index: 1;
  --seek-buffered: 0%;
}
.seek-marks{
  position: absolute; left: 0; right: 0; top: 50%; height: 4px;
  transform: translateY(-50%);
  pointer-events: none;
}
.seek-marks span{
  position: absolute; top: 0; bottom: 0;
  background: var(--accent-orange);
  opacity: .6;
  border-radius: 2px;
  min-width: 2px;
}
/* Время под курсором над таймлайном, того же вида, что подсказки кнопок */
.seek-tip{
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface);
  border: 1px solid #23272e;
  color: var(--text);
  padding: 5px 9px;
  border-radius: 6px;
  font-family:'JetBrains Mono', monospace; font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.seek-tip.show{
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
#seek::-webkit-slider-runnable-track{
  background-image:
    linear-gradient(var(--accent), var(--accent)),
    linear-gradient(rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.32));
  background-size: var(--fill) 100%, var(--seek-buffered) 100%;
}
#volume-range{ width: 80px; }

/* Firefox: те же ползунки через -moz-, заливку до бегунка красит range-progress сам */
input[type=range]::-moz-range-track{
  height: 4px;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.14);
  background-repeat: no-repeat;
  background-position: left center;
}
#seek::-moz-range-track{
  background-image: linear-gradient(rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.32));
  background-size: var(--seek-buffered) 100%;
}
input[type=range]::-moz-range-progress{
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
input[type=range]::-moz-range-thumb{
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
}

/* Динамик и ползунок это одно целое: у иконки справа своё поле внутри квадрата кнопки, зазор почти не нужен.
   Отрицательный отступ слева компенсирует поле квадрата и пустоту внутри иконки: от дорожки до динамика те же 15px, что слева от неё */
.volume-group{ display:flex; align-items:center; gap: 3px; margin-left: -9px; }

/* ---------- Иконка плей/пауза по центру ---------- */
.center-play-icon{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.center-play-icon.show{
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.center-play-icon svg{
  width: 32px;
  height: 32px;
  fill: white;
}
.stage.controls-hidden .center-play-icon{
  opacity: 0 !important;
}

/* ---------- Подсказки "Следующая серия" / "Пропустить" ---------- */
.quick-action-btn{
  position: absolute;
  right: 27px;
  bottom: 76px;
  z-index: 6;
  max-width: calc(100% - 24px);
  background-color: var(--btn-grey);
  background-image: var(--btn-sheen);
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-family: 'Inter-SemiBold', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  user-select: none; /* иначе на некоторых браузерах при наведении на текст кнопки вместо pointer показывается текстовый курсор */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 24px rgba(0,0,0,.4);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .3s ease, transform .3s ease, background-color .2s ease, box-shadow .2s ease, visibility 0s .3s;
}
.quick-action-btn.show{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .3s ease, transform .3s ease, background-color .2s ease, box-shadow .2s ease, visibility 0s 0s;
}
.quick-action-btn.show:hover{ background-color: var(--btn-grey-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 24px rgba(0,0,0,.4); }
.quick-action-btn.show:active{ transform: scale(.97); }

/* ---------- Панель звука (Компрессор/буст) ---------- */
.dr-panel{
  position:absolute; right: 12px; left: 12px; bottom: 62px; z-index: 6;
  width: auto; max-width: 300px; margin-left: auto;
  background-color: var(--surface);
  background-image: var(--panel-sheen);
  border: 1px solid #23272e;
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  box-shadow: var(--panel-edge-light), 0 8px 24px rgba(0,0,0,.35);
  /* visibility убирает контент из порядка Tab, задержка 0s .3s прячет после анимации исчезновения */
  visibility: hidden;
  transition: opacity .3s ease, transform .3s ease, visibility 0s .3s;
  /* Две трети экрана, а не половина: на большом мониторе половина это мало */
  max-height: min(calc(100% - 76px), 65vh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a3f46 transparent;
}
.dr-panel::-webkit-scrollbar{
  width: 8px;
}
.dr-panel::-webkit-scrollbar-track{
  background: transparent;
  margin: 4px 0;
}
.dr-panel::-webkit-scrollbar-thumb{
  background-color: #3a3f46;
  border-radius: 8px;
  border: 2px solid var(--surface);
  background-clip: padding-box;
}
.dr-panel::-webkit-scrollbar-thumb:hover{
  background-color: var(--accent-orange);
}
.dr-panel.open{ opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; transition: opacity .3s ease, transform .3s ease, visibility 0s 0s; }
.stage.controls-hidden .dr-panel:not(.open){ opacity:0; pointer-events:none; }
.dr-row{
  display:flex; align-items:center; gap: 10px; margin-bottom: 13px;
}
.dr-row:last-child{ margin-bottom: 0; }
.dr-row label{
  font-size: 12px; color: var(--muted); flex-shrink: 0; min-width: 40px; white-space: nowrap;
}
.dr-row label.checkbox{ min-width: 18px; }
.dr-row input[type=range]{ flex:1 1 auto; min-width: 0; height:12px; margin:0; }
.dr-label{ font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dr-val{
  font-family:'JetBrains Mono', monospace; font-size: 11px; color: var(--muted);
  width: 38px; text-align:right; flex-shrink:0;
}

.checkbox{ position:relative; display:inline-flex; width:18px; height:18px; flex-shrink:0; cursor:pointer; }
.checkbox input{
  opacity:0; width:18px; height:18px; position:absolute; margin:0; padding:0; inset:0;
  border:none; background:none; appearance:none; -webkit-appearance:none; cursor:pointer;
  outline:none;
}
.checkbox .box{
  position:absolute; inset:0; border-radius:3px;
  border:1px solid #3a3f46; background:#1B1F26; transition: background .2s ease, border-color .2s ease;
  display:flex; align-items:center; justify-content:center;
  transition:.15s ease;
}
.checkbox:hover .box{
  border-color: var(--text);
}
/* Галочка тот же штрих, что у плюса и у кнопки сохранения тайминга: одна линия, скруглённые концы, по центру */
.checkbox .box:after{
  content:""; width:12px; height:12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B0D10' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity:0; transition:.1s ease;
}
.checkbox input:checked + .box{ background-color: var(--accent-orange); background-image: var(--btn-sheen); border-color: rgba(255,240,190,0.35); box-shadow: inset 0 1px 0 rgba(255,250,225,0.5); }
.checkbox input:checked + .box:after{ opacity:1; }
.checkbox:hover input:checked + .box{ background-color: var(--accent-orange-hover); box-shadow: inset 0 1px 0 rgba(255,252,235,0.6); }
.checkbox input:focus-visible + .box{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Категории настроек ---------- */
.dr-category{
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #23272e;
}
.dr-category:last-child{
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.dr-category-header{
  width: calc(100% + 20px);
  margin: 0 -10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s ease;
}
.dr-category-header:hover{
  background: var(--surface-2);
}
.dr-category-header[aria-expanded="true"] .dr-category-arrow{
  transform: rotate(0deg);
}

/* Скрываем tooltip для кнопки настроек когда панель открыта */
.ctrl-btn.active-panel::after{
  display: none;
}
.dr-category-title{
  font-family:'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
}
.dr-category-arrow{
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform .2s ease;
}
.dr-category-header[aria-expanded="false"] .dr-category-arrow{
  transform: rotate(-90deg);
}
.dr-category-content{
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  transition: max-height .3s ease, opacity .2s ease, padding .2s ease;
  opacity: 1;
}
.dr-category-content.collapsed{
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  /* иначе поля свёрнутой категории остаются доступны с клавиатуры */
  visibility: hidden;
  transition: max-height .3s ease, opacity .2s ease, padding .2s ease, visibility 0s .3s;
}
.dr-text-input{
  background: var(--surface); border:1px solid #2a2f37; border-radius: 6px;
  color: var(--text); font-family:'Inter-Medium', sans-serif; font-weight: 300; font-size: 13.5px;
  padding: 6px 9px; flex:1; min-width:0;
  outline:none; transition: border-color .15s ease;
}
.dr-text-input:focus{
  border-color: var(--accent);
}

.subs-file-name{
  font-size: 12px; color: var(--muted); flex: 1 1 auto;
  min-width: 0; /* чтобы сжимался и не выталкивал кнопку удаления */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.timing-hint{
  font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-bottom: 12px;
}
.timing-input-row{ align-items:center; margin-bottom: 0; }
.timing-time-input{
  font-family:'JetBrains Mono', monospace; text-align:center; letter-spacing: normal;
  flex: 1 1 0; min-width: 0; padding: 6px 4px;
}
.timing-segmented{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.timing-segmented:focus-within{
  border-color: var(--accent);
}
.ts-seg{
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  text-align: center;
  width: 2ch;
  min-width: 0;
  padding: 0;
}
.ts-seg::placeholder{
  color: var(--muted);
  opacity: .7;
}
.ts-colon{
  color: var(--muted);
  flex-shrink: 0;
  user-select: none;
}
.timing-dash{ color: var(--muted); flex-shrink:0; }
.timing-add-btn{
  width: 26px; height: 26px; padding: 0; flex-shrink:0;
  background-color: var(--accent-orange); background-image: var(--btn-sheen);
  border: var(--btn-edge); box-shadow: var(--btn-shadow); color: #0B0D10; font-size: 16px; font-weight: 300;
  border-radius: 6px; display:flex; align-items:center; justify-content:center;
  transition: background-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
/* Плюс и галочка нарисованы, а не набраны: текстовый «+» сидел ниже центра из-за строки шрифта */
.timing-add-btn svg{
  display: block;
  width: 14px;
  height: 14px;
  stroke: #0B0D10;
}
.timing-add-btn:hover{ background-color: var(--accent-orange-hover); box-shadow: var(--btn-shadow-hover); }
.timing-add-btn:active{ transform: scale(0.97); }
.timing-err{
  color: var(--accent-red); font-size: 11.5px; font-family:'JetBrains Mono', monospace;
  line-height: 1.4;
  margin: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .3s ease, opacity .3s ease, margin .3s ease;
}
.timing-err.show{
  margin: 10px 0 0;
  max-height: 34px;
  opacity: 1;
}
.timing-list{ display:flex; flex-direction:column; transition: margin-top .3s ease; }
.timing-list:not(:empty){ margin-top: 10px; }
.timing-item{
  display:flex; align-items:center; justify-content:space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #20242b;
  max-height: 40px;
  opacity: 1;
  overflow: visible;
  transition: max-height .3s ease, opacity .3s ease, padding .3s ease, border-color .3s ease;
}
.timing-item:last-child{ border-bottom:none; }
.timing-item.collapsed{
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
}
.timing-range{
  font-family:'JetBrains Mono', monospace; font-size: 12.5px; color: var(--text);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  position: relative;
  padding-bottom: 2px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .15s ease;
}
/* Подчёркивание только под текстом, как у названия в шапке */
.timing-range-text{ position: relative; padding-bottom: 2px; }
.timing-range-text::before{
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--muted);
  transform: scaleX(0);
  transition: transform .15s ease;
}
.timing-range:hover{
  color: var(--muted);
}
.timing-range:hover .timing-range-text::before{
  transform: scaleX(1);
}
.timing-edit-icon{
  width: 13px; height: 13px; flex-shrink: 0;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity .15s ease, transform .15s ease;
}
.timing-range:hover .timing-edit-icon{
  opacity: 1;
  transform: translateX(0);
}
.timing-remove-btn{
  background: transparent; padding: 4px 6px; font-size: 14px; line-height:1;
  color: var(--muted); border-radius: 5px; flex-shrink:0;
  display: flex; align-items: center; justify-content: center;
}
.timing-remove-btn svg{
  width: 16px; height: 16px;
}
.timing-remove-btn:hover{ color: var(--accent-red); }

.timing-item.editing{
  align-items: stretch;
  padding: 8px 0;
  max-height: none;
}
.timing-edit-container{
  display: flex;
  width: 100%;
}
.timing-edit-inputs{
  display: flex;
  align-items: center;
  width: 100%;
}
/* Рядом с полями стоят две кнопки, места меньше, чем в строке добавления: поля те же, что там, без лишних полей внутри */
.timing-edit-container .timing-time-input{
  border-color: #33383f;
  padding: 6px 3px;
}
.timing-edit-inputs{ gap: 6px; }
.timing-edit-container .ts-seg{
  width: 2ch;
  flex: 0 0 auto;
}
.timing-edit-container .timing-segmented:focus-within{
  border-color: var(--accent);
  outline: none;
}
.timing-edit-container .timing-segmented.has-error{
  border-color: var(--accent-red) !important;
}
/* Кнопка-галочка в строке инпутов, тот же класс/размер, что и timing-add-btn сверху */
.timing-edit-inputs .timing-add-btn svg{
  stroke: #0B0D10;
}
/* Галочка и крестик, сгруппированы вместе, с маленьким отступом друг от друга */
.timing-edit-confirm-group{
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.timing-edit-confirm-group .timing-remove-btn{
  flex-shrink: 0;
}

/* ---------- Панель плейлиста ---------- */
/* Кнопка выбора серии в левом верхнем углу сцены, серая, как «Назад», прячется вместе с контролами */
.episode-btn{
  position: absolute; top: 12px; left: 12px; z-index: 6;
  display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 24px);
  font-family: 'Inter-SemiBold', sans-serif; font-weight: 600; font-size: 13.5px; letter-spacing: 0.01em;
  padding: 9px 11px 9px 15px; border-radius: 6px;
  background-color: var(--btn-grey); background-image: var(--btn-sheen);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 14px rgba(0,0,0,.35);
  color: var(--text);
  transition: background-color .2s ease, box-shadow .2s ease, transform .12s ease, opacity .2s ease;
}
.episode-btn:hover{ background-color: var(--btn-grey-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 14px rgba(0,0,0,.35); }
.episode-btn:active{ transform: scale(.97); }
.episode-btn-label{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.episode-btn-chevron{ width: 16px; height: 16px; flex-shrink: 0; transition: transform .2s ease; }
.episode-btn[aria-expanded="true"] .episode-btn-chevron{ transform: rotate(180deg); }
.stage.controls-hidden .episode-btn:not(.active-panel){ opacity: 0; pointer-events: none; }

/* Уменьшение подсказок и кнопки серии на небольших экранах, блок стоит после базовых правил, иначе они его перебивают */
@media (max-width: 1440px){
  .quick-action-btn{
    padding: 9px 16px;
    font-size: 12.5px;
    right: 22px;
  }
  .episode-btn{ padding: 9px 12px 9px 16px; font-size: 12.5px; }
}

@media (max-width: 1366px){
  .quick-action-btn{
    padding: 8px 14px;
    font-size: 12px;
    right: 18px;
  }
  .episode-btn{ padding: 8px 10px 8px 14px; font-size: 12px; }
}

@media (max-width: 1280px){
  .quick-action-btn{
    padding: 7px 12px;
    font-size: 11.5px;
    right: 15px;
  }
  .episode-btn{ padding: 7px 8px 7px 12px; font-size: 11.5px; }
}

@media (max-width: 1024px){
  .quick-action-btn{
    padding: 6px 10px;
    font-size: 11px;
    right: 12px;
  }
  .episode-btn{ padding: 6px 6px 6px 10px; font-size: 11px; }
  #playlist-panel{ top: 44px; }
}

/* Список серий раскрывается под кнопкой, той же ширины по минимуму, с прокруткой при длинном сезоне */
#playlist-panel{
  position:absolute; left: 12px; top: 52px; right: auto; bottom: auto; z-index: 6;
  width: 260px; max-width: calc(100% - 24px); margin-left: 0;
  background-color: var(--surface);
  background-image: var(--panel-sheen);
  border: 1px solid #23272e;
  border-radius: var(--radius);
  padding: 12px 12px 12px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  box-shadow: var(--panel-edge-light), 0 8px 24px rgba(0,0,0,.35);
  /* visibility убирает контент из порядка Tab, задержка 0s .3s прячет после анимации исчезновения */
  visibility: hidden;
  transition: opacity .3s ease, transform .3s ease, visibility 0s .3s;
  box-sizing: border-box;
  max-height: calc(100% - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a3f46 transparent;
}
#playlist-panel::-webkit-scrollbar{
  width: 8px;
}
#playlist-panel::-webkit-scrollbar-track{
  background: transparent;
  margin: 4px 0;
}
#playlist-panel::-webkit-scrollbar-thumb{
  background-color: #3a3f46;
  border-radius: 8px;
  border: 2px solid var(--surface);
  background-clip: padding-box;
}
#playlist-panel::-webkit-scrollbar-thumb:hover{
  background-color: var(--accent-orange);
}
#playlist-panel.open{ opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; transition: opacity .3s ease, transform .3s ease, visibility 0s 0s; }
.playlist-list{
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.playlist-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease;
}
.playlist-item:hover{
  background: #2a2f37;
}
/* Активная серия белая, остальные приглушены, без акцентного цвета */
.playlist-item.active{
  background: #2a2f37;
  color: var(--text);
}
.playlist-item-name{
  font-size: 12.5px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .15s ease;
}
.playlist-item:hover .playlist-item-name,
.playlist-item.active .playlist-item-name{
  color: var(--text);
}


/* ---------- Адаптивность/Мобильные ---------- */
/* Панель управления остаётся одной строкой: вторая строка отнимает у видео высоту и двигает кнопки */
@media (max-width: 1024px){
  .controls-bar{ flex-wrap: nowrap; }
  #volume-range{ width: 64px; }
}

@media (max-width: 720px){
  .dropzone-group{ flex-direction: column; }
  .stage{ margin: 0 10px 10px; }
  .toolbar{ padding: 16px 10px 12px; gap: 10px; }
  .player-title{ font-size: 20px; max-width: 55vw; }
  .back-btn{ font-size: 11.5px; padding: 6px 10px; }
  .center-play-icon{ width: 56px; height: 56px; }
  .center-play-icon svg{ width: 26px; height: 26px; }
}

@media (max-width: 560px){
  .controls-bar{
    padding: 16px 6px 6px;
    gap: 3px;
    row-gap: 4px;
    flex-wrap: nowrap;
  }
  .playback-group{ gap: 4px; }
  .extra-group{ gap: 3px; }
  /* сбрасываем фиксированные 150px из базового правила, иначе кнопки уезжают за край */
  .time-display{ width: auto; min-width: 0; font-size: 9px; }
  #volume-range{ width: 35px; }
  .volume-group{ gap: 2px; }
  .ctrl-btn{ width: 26px; height: 26px; }
  .ctrl-btn svg{ width: 16px; height: 16px; }
  .ctrl-btn#fullscreen-btn svg{ width: 15px; height: 15px; }
  .center-play-icon{ width: 38px; height: 38px; }
  .center-play-icon svg{ width: 16px; height: 16px; }
}

@media (max-width: 380px){
  .controls-bar{
    padding: 20px 8px 8px;
    gap: 4px;
  }
  .playback-group{ gap: 4px; }
  .extra-group{ gap: 3px; }
  .ctrl-btn svg{ width: 18px; height: 18px; }
  .ctrl-btn#fullscreen-btn svg{ width: 16px; height: 16px; }
  .time-display{ font-size: 10.5px; }
  #volume-range{ width: 40px; }
  .volume-group{ gap: 3px; }
  .center-play-icon{ width: 42px; height: 42px; }
  .center-play-icon svg{ width: 18px; height: 18px; }
}

@media (max-height: 420px) and (orientation: landscape){
  .toolbar{ padding: 8px 10px; }
  .player-title{ display:none; }
  .dr-panel{ max-height: calc(100% - 56px); bottom: 54px; }
  .center-play-icon{ width: 46px; height: 46px; }
  .center-play-icon svg{ width: 20px; height: 20px; }
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 34px 12px 16px;
  border-radius: 10px;
  color: #F2E4DF;
  font-size: 13px;
  line-height: 1.4;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .25s ease, transform .25s ease, visibility 0s .25s;
}
.toast.show{
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .25s ease, transform .25s ease, visibility 0s 0s;
}
.toast-close{
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}
.toast-close svg{
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.toast-close:hover{
  color: #ffffff;
  background: rgba(255,255,255,.1);
}

.toast-error{
  background: #2A1D1A;
  border: 1px solid #E08B7D;
}

.toast-warning{
  background: #2A2210;
  border: 1px solid var(--accent-orange);
}
/* Нейтральная справка: у неё нет красной рамки, красная только про сбой */
.toast-info{
  background: var(--surface);
  border: 1px solid #2f343c;
  color: var(--text);
}
.toast-text strong{
  color: var(--accent-orange);
  font-weight: 500;
  font-family: 'Inter-SemiBold', sans-serif;
}

/* ---------- Шпаргалка по клавишам ---------- */
/* Живёт там же, где панель настроек: в правом нижнем углу над панелью управления, видео остаётся на виду */
.hotkeys-help{
  position: absolute; right: 12px; bottom: 62px; z-index: 6;
  width: max-content;
  max-width: calc(100% - 24px);
  max-height: min(calc(100% - 76px), 65vh);
  overflow-y: auto;
  background-color: var(--surface);
  background-image: var(--panel-sheen);
  border: 1px solid #23272e;
  border-radius: var(--radius);
  box-shadow: var(--panel-edge-light), 0 8px 24px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, visibility 0s .3s;
  scrollbar-width: thin;
  scrollbar-color: #3a3f46 transparent;
}
.hotkeys-help.show{
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s ease, transform .3s ease, visibility 0s 0s;
}
.stage.controls-hidden .hotkeys-help:not(.show){ opacity: 0; pointer-events: none; }
.hotkeys-card{ padding: 16px 18px 18px; }
.hotkeys-title{
  font-family:'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text); margin-bottom: 12px; text-align: center;
}
/* Клавиши прижаты к правому краю своей колонки: клавиши и описания встречаются на одной вертикали */
.hotkeys-list{
  display: grid; grid-template-columns: auto 1fr; column-gap: 16px; row-gap: 9px;
  align-items: center; margin: 0;
}
.hotkeys-list dt{ white-space: nowrap; text-align: right; display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.hotkeys-list dd{ margin: 0; font-size: 12.5px; color: var(--muted); }
.hotkeys-list kbd.wide{ width: 54px; }
/* Клавиши это квадраты 25px, Space шириной ровно в два квадрата с зазором между ними */
.hotkeys-list kbd{
  display: inline-flex; align-items: center; justify-content: center;
  width: 25px; height: 25px; padding: 0; border-radius: 5px;
  font-family:'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text);
  background-color: var(--surface-2); background-image: var(--panel-sheen);
  box-shadow: var(--panel-edge-light), 0 1px 0 rgba(0,0,0,.4);
}
