* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: system-ui, Arial, sans-serif; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app { height: 100%; display: flex; flex-direction: column; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid #ddd;
}
.title { font-weight: 700; }
.actions { display: flex; gap: 8px; }

.main {
  flex: 1; display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 12px; padding: 12px; overflow: hidden;
}

section.left, section.right {
  border: 1px solid #ddd; border-radius: 10px; padding: 10px;
  overflow: hidden; display: flex; flex-direction: column;
}

.panelTitle { font-weight: 700; margin-bottom: 8px; }

.utterances { overflow: auto; padding-right: 6px; }
.utt {
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    padding: 10px;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 10px;
    background: #fff;
    transition: all .2s ease;
}
.uttHeader { display:flex; justify-content: space-between; gap: 10px; align-items: center; }
.uttTime { font-variant-numeric: tabular-nums; color: #666; font-size: 12px; }
.utt textarea { width: 100%; min-height: 56px; resize: vertical; }

.badge { font-size: 12px; padding: 4px 8px; border-radius: 999px; border: 1px solid #ddd; }
.btnSmall { padding: 6px 10px; border-radius: 8px; border: 1px solid #ddd; background: #f7f7f7; }

.uploadBox .hint { color:#666; font-size: 12px; margin: 6px 0 10px; }
.status { color:#444; margin-top: 8px; font-size: 12px; }
div#videoBox {
    max-height: -webkit-fill-available;
}
.videoBox video {
    width: 100%;
    max-height: calc(100% - 120px);
    background: #000;
    border-radius: 10px;
}
.trackControls { display: flex; gap: 14px; align-items: center; margin-top: 8px; font-size: 14px; }
.secondary { background:#fff; border:1px solid #ddd; border-radius:8px; padding: 6px 10px; }

.footer {
  border-top: 1px solid #ddd;
  padding: 10px 12px;
}

.waveWrap {
  display: grid;
  grid-template-columns: 160px 1fr; /* как у trackRow */
  gap: 10px;
  align-items: start;
}

.waveGutter {
  height: 1px; /* просто пустое место, чтобы выровнять */
}

.playerBar { display:flex; align-items:center; gap: 12px; margin-top: 8px; }
.time { font-variant-numeric: tabular-nums; color:#333; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 2;
}
.modalBackdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.35); }
.modalCard {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, 92vw); background: #fff; border-radius: 12px;
  border: 1px solid #ddd; overflow: hidden;
}
.modalHeader { display:flex; justify-content: space-between; padding: 10px 12px; border-bottom:1px solid #eee; font-weight:700; }
.charactersList { padding: 12px; display:flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow:auto; }
.charRow { display:flex; justify-content: space-between; align-items: center; border:1px solid #eee; border-radius: 10px; padding: 8px 10px; }
.modalFooter { display:flex; gap: 8px; padding: 12px; border-top:1px solid #eee; }
.modalFooter input { flex: 1; padding: 8px 10px; border-radius: 10px; border: 1px solid #ddd; }
.tracksHeader { font-weight: 700; margin-bottom: 6px; }

.trackRow {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #eee;
}
.trackRow:last-child { border-bottom: none; }

.trackLabel {
  font-size: 13px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.videoBox video {
  pointer-events: none; /* чтобы не ловить клики */
}
.clip {
  position: absolute;
  top: 4px;
  height: 26px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  cursor: grab;
  user-select: none;
  justify-content: space-between;
}
.clipTitle {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.handle {
  width: 10px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #f1f1f1;
  cursor: ew-resize;
  position: absolute;
}
.handle.left { margin-left: -4px; left: 2px; }
.handle.right { margin-right: -4px; right: 2px; }

.tracksScroll{
  overflow-x: auto;     /* важно */
  overflow-y: hidden;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px;
}

.uttBody {
  display: grid;
  grid-template-columns: 1fr 1fr auto; /* orig | translation | controls */
  gap: 10px;
  margin-top: 8px;
  align-items: start;
}

.uttColTitle {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.uttCol textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
}

.uttMeta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 140px;
}

.uttMeta select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
}
.afterUploadActions { margin-top: 10px; display:flex; gap: 10px; align-items:center; }
.zoomBox { display:flex; align-items:center; gap:8px; margin-left:auto; }
.zoomBox input { width: 180px; }


/* правая часть: только X, без Y */
.timelineScroll{
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* old Edge */
}
.timelineScroll::-webkit-scrollbar{ height: 0; } /* Chrome/Safari */
.timelineGrid{
  display: grid;
  grid-template-columns: 160px 1fr; /* ширина левой колонки как у твоих лейблов */
  gap: 10px;
  align-items: start;
}

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

.labelsSpacer {
  height: 70px;
  margin-bottom: 6px;
  margin-top: 18px;
}

.timelineContent{
  position: relative;
}

.timelinePane{
  max-height: 250px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.timelineVScroll{
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
}

/* всегда видимый нижний горизонтальный скролл */
.timelineHScroll{
  flex: 0 0 16px;       /* высота полосы */
  overflow-x: auto;
  overflow-y: hidden;
}

/* “начинка”, чтобы появилась ширина для скролла */
.timelineHScrollInner{
  height: 1px;
}


/* волна/таймлайн остаются как были, но теперь внутри timelineContent */
.waveTimeline { height: 18px; }
.wave { height: 70px; border: 1px solid #ddd; border-radius: 10px; overflow: hidden; }

/* лейблы персонажей слева */
.tracksLabels{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trackLabelRow{
  height: 34px;                 /* как .trackLane */
  display:flex;
  align-items:center;
  font-size: 13px;
  color:#333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}

/* дорожки справа */
.tracks{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.trackLane{
  position: relative;
  height: 34px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}
.timelineTopBar{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 12px 10px;
}

.playBtn{
  width: 66px;
  height: 48px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.playBtn svg{
  width: 33px;
  height: 33px;
  fill: #111;
}

.playBtn:disabled{
  opacity: .35;
  cursor: default;
}

.topBarRight{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.timeTop{
  font-variant-numeric: tabular-nums;
  color: #111;
}

.zoomBoxTop{
  display:flex;
  align-items:center;
  gap:8px;
}

.zoomBoxTop input{ width: 180px; }
.timelineContent{ position: relative; }

.playheadLine{
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #111;
  z-index: 50;
  pointer-events: auto;
  opacity: 0.9;
  cursor: ew-resize;
}
/* короткая подсветка карточки реплики */
.utt.uttFlash {
    border-color: #cbcbcb;
    box-shadow: 0 0 0 3px rgba(0,0,0,.08);
    background: #fff4f4;
    transition: box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.utt.uttActive {
  outline: 4px solid rgb(255 57 57 / 22%);
  outline-offset: 2px;
}
.panelTitleRow{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.panelTitleRow .panelTitle{ margin-bottom: 0; }

/* было: 1fr 1fr auto */
.uttBody {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto; /* orig | translate | translation | controls */
  gap: 10px;
  margin-top: 8px;
  align-items: start;
}

.uttMid{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 20px; /* чтобы стрелка оказалась между заголовками */
  min-width: 84px;
}

.uttMid .arrow{ opacity: .7; }
.uttMid .btnSmall{ width: 100%; }

.openProjectBox{ margin-top: 14px; display:flex; flex-direction:column; gap:10px; }
.openRow{ display:flex; gap:10px; }
.openRow select, .openRow input{ flex:1; }
button.danger{
  border: 1px solid #c33;
  color: #c33;
  background: #fff;
}
button.danger:hover{
  background: rgba(204,51,51,.06);
}
.videoBox{ position: relative; }

.subtitlesOverlay{
  position: absolute;
  left: 50%;
  bottom: 140px;
  transform: translateX(-50%);
  max-width: min(900px, 92%);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  text-align: center;
  line-height: 1.35;
  font-size: 16px;
  z-index: 3;
  pointer-events: none;
  white-space: pre-wrap;
}
