* { box-sizing: border-box; }
body {
  margin: 0; background: #121212; color: #f1f1f1;
  font-family: "Noto Sans Bengali", "Hind Siliguri", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: #1c1c1e; border-bottom: 1px solid #333;
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap; gap: 8px;
}
.brand { font-size: 20px; font-weight: 700; }
.brand span { color: #ff4d4d; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-block; background: #2c2c2e; color: #fff; border: 1px solid #444;
  border-radius: 10px; padding: 12px 16px; font-size: 16px; cursor: pointer;
  font-family: inherit; text-align: center; min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: #c8102e; border-color: #c8102e; font-weight: 700; }
.btn.small { padding: 10px 12px; font-size: 15px; min-height: 42px; }
.btn.big { font-size: 17px; font-weight: 700; padding: 12px 22px; }
.btn.danger { background: #5a1a1a; border-color: #7a2a2a; }

main { max-width: 900px; margin: 0 auto; padding: 12px 12px 40px; }

#stage {
  position: relative; width: 100%; aspect-ratio: 16/9; background: #000;
  border-radius: 12px; overflow: hidden;
}
#previewVideo, #previewImg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: none; background: #000;
}
#textLayer { position: absolute; inset: 0; pointer-events: none; }
#textLayer .ovl {
  position: absolute; font-weight: 700; white-space: pre-wrap;
  text-shadow: 0 2px 6px rgba(0,0,0,.7); line-height: 1.2;
}
#emptyState {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; color: #888; font-size: 17px; line-height: 1.7;
}
#transport { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
#timeLabel { white-space: nowrap; font-size: 15px; color: #ccc; min-width: 110px; }
#seekBar { flex: 1; accent-color: #c8102e; height: 30px; }

#timelineSection { margin-top: 18px; }
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.section-title span { color: #999; font-weight: 400; font-size: 14px; }
#timelineWrap { position: relative; }
#timeline {
  display: flex; gap: 4px; min-height: 64px; background: #1c1c1e;
  border-radius: 10px; padding: 6px; overflow-x: auto;
}
.clip-block {
  flex: 1 0 auto; min-width: 56px; border-radius: 8px; padding: 8px 6px;
  font-size: 13px; line-height: 1.35; cursor: pointer; overflow: hidden;
  border: 2px solid transparent; color: #fff; user-select: none;
  display: flex; flex-direction: column; justify-content: center;
}
.clip-block.sel { border-color: #fff; box-shadow: 0 0 0 2px #c8102e; }
.clip-block .cname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-block .cdur { opacity: .85; }
#playhead {
  position: absolute; top: 0; bottom: 0; width: 3px; background: #ff4d4d;
  left: 0; pointer-events: none; border-radius: 2px;
}
#clipBar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
#clipInfo { color: #aaa; font-size: 14px; }

#toolbar {
  display: flex; gap: 4px; overflow-x: auto; background: #1c1c1e;
  border-radius: 12px; padding: 6px; margin-top: 14px;
}
.tool {
  flex: 1; min-width: 80px; background: none; border: none; color: #aaa;
  font-family: inherit; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding: 10px 4px; font-size: 14px; border-radius: 8px;
}
.tool .ico { font-size: 24px; line-height: 1; }
.tool.active { color: #fff; background: #2c2c2e; box-shadow: inset 0 -3px 0 #c8102e; }

#panels { margin-top: 10px; }
.panel {
  display: none; background: #1c1c1e; border: 1px solid #333;
  border-radius: 12px; padding: 16px 14px;
}
.panel.active { display: block; }
.hint { color: #999; font-size: 14px; line-height: 1.6; }
.row { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; align-items: flex-end; }
.row label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #ccc; flex: 1; min-width: 120px; }
.row label.grow { flex: 3; }
.row label.check { flex-direction: row; align-items: center; }
input[type="number"], input[type="text"] {
  background: #121212; color: #fff; border: 1px solid #444; border-radius: 8px;
  padding: 11px 10px; font-size: 16px; font-family: inherit; width: 100%;
}
input[type="range"] { accent-color: #c8102e; width: 100%; height: 28px; }
input[type="color"] { width: 60px; height: 44px; padding: 2px; background: #121212; border: 1px solid #444; border-radius: 8px; }
.speeds { display: flex; gap: 6px; }
.speedBtn {
  padding: 11px 14px; font-size: 15px; background: #2c2c2e; color: #fff;
  border: 1px solid #444; border-radius: 8px; cursor: pointer; font-family: inherit;
}
.speedBtn.active { background: #c8102e; border-color: #c8102e; }
.sliders label { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 15px; }
.sliders label input { flex: 1; }
.sliders label span { min-width: 28px; text-align: right; color: #ccc; }
#textList { margin-top: 14px; }
.text-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #2c2c2e; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  font-size: 15px; cursor: pointer;
}
.text-item.sel { outline: 2px solid #c8102e; }
.text-item button { background: #5a1a1a; color: #fff; border: none; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.foot { color: #888; font-size: 13px; text-align: center; margin-top: 24px; line-height: 1.6; }

#exportOverlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#exportOverlay[hidden] { display: none; }
.export-box { background: #1c1c1e; border-radius: 14px; padding: 24px; width: 100%; max-width: 420px; text-align: center; }
.export-box h2 { margin: 0 0 16px; font-size: 20px; }
.progress { background: #333; border-radius: 8px; height: 14px; overflow: hidden; }
#exportBar { height: 100%; width: 0%; background: #c8102e; transition: width .2s; }
#exportLabel { font-size: 18px; font-weight: 700; margin: 12px 0 4px; }

@media (min-width: 700px) {
  #transport { margin-top: 12px; }
  .clip-block { min-width: 90px; }
}
