:root {
  --ink: #f4efe6;
  --muted: #a39a8c;
  --bg0: #12100e;
  --bg1: #1b1714;
  --panel: rgba(34, 29, 24, 0.88);
  --line: rgba(244, 239, 230, 0.1);
  --gold: #f0c23a;
  --gold-soft: #ffe08a;
  --mint: #7fd6b0;
  --danger: #ff7a6e;
  --ok: #8fdfa8;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font-display: "Bricolage Grotesque", "Noto Sans Bengali", sans-serif;
  --font-body: "Source Sans 3", "Noto Sans Bengali", sans-serif;
  --font-bn: "Noto Sans Bengali", "Source Sans 3", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg0);
}

body {
  position: relative;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(240, 194, 58, 0.18), transparent 55%),
    radial-gradient(700px 480px at 90% 10%, rgba(127, 214, 176, 0.12), transparent 50%),
    linear-gradient(165deg, #171310 0%, #0f0e0c 45%, #141816 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 40% 20%, black, transparent 75%);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  font-family: var(--font-bn);
  font-weight: 800;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--bg0);
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  padding: 0.55rem 0.7rem 0.4rem;
  border-radius: 14px;
  letter-spacing: -0.02em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.85rem;
}

.top-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1.15rem;
  font: 650 0.95rem/1 var(--font-body);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: #1a1408;
}

.btn.secondary {
  background: rgba(255,255,255,0.06);
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.file-btn { display: inline-flex; align-items: center; }

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 1.25rem;
  padding: 1.25rem 1.5rem 5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.hero-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  padding: 1.35rem 1.35rem 1.1rem;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 700;
}

.hero-panel h1 {
  margin: 0.35rem 0 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.1rem);
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.lede {
  margin: 0 0 1.1rem;
  color: var(--muted);
  max-width: 38rem;
  font-size: 1.02rem;
}

.preview-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.7rem;
}

.ptab {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: 650 0.82rem/1 var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ptab.active {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-color: transparent;
  color: #1a1408;
}

.ptab:not(.active):hover {
  color: var(--ink);
  border-color: rgba(240, 194, 58, 0.4);
}

.player-shell {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #070706;
  border: 1px solid var(--line);
  aspect-ratio: 9 / 16;
  max-height: min(68vh, 720px);
  margin-inline: auto;
  width: min(100%, 420px);
}

.live-caption {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 12%;
  text-align: center;
  font-family: var(--font-bn);
  font-weight: 800;
  font-size: clamp(1rem, 2.6vw, 1.5rem);
  line-height: 1.4;
  color: #fff;
  cursor: grab;
  user-select: none;
  touch-action: none;
  text-shadow:
    -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000,
    0 4px 10px rgba(0,0,0,0.6);
  z-index: 3;
}

.live-caption.dragging {
  cursor: grabbing;
  outline: 2px dashed rgba(240, 194, 58, 0.7);
  outline-offset: 6px;
  border-radius: 8px;
}

.live-caption .active {
  color: var(--hl, #ffe500);
  display: inline-block;
  transform: scale(1.08);
}

.preview-hint {
  margin: 0.5rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.player-shell video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #070706;
  display: none;
}

.player-shell.has-video video { display: block; }
.player-shell.has-video .empty-preview { display: none; }

.empty-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.95rem;
  background:
    radial-gradient(circle at 50% 40%, rgba(240,194,58,0.08), transparent 55%);
}

.video-rail {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 1rem 0 0.2rem;
  scrollbar-width: thin;
}

.video-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  text-align: left;
  cursor: pointer;
  min-width: 160px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.video-chip.active,
.video-chip:hover {
  border-color: rgba(240, 194, 58, 0.55);
  background: rgba(240, 194, 58, 0.08);
}

.video-chip strong {
  display: block;
  font-size: 0.86rem;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-chip span {
  color: var(--muted);
  font-size: 0.75rem;
}

.workbench {
  animation: rise 0.7s ease both;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.05rem;
  opacity: 0.72;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.step.active {
  opacity: 1;
  border-color: rgba(240, 194, 58, 0.35);
}

.step > header {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.step .num {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--gold);
  font-size: 0.95rem;
  min-width: 1.8rem;
}

.step h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.step header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.field select {
  background: #100e0c;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  font: 600 0.92rem/1 var(--font-body);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}

.draft-editor {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 280px;
  overflow: auto;
  padding-right: 0.2rem;
}

.seg-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.75rem;
  background: rgba(0,0,0,0.22);
}

.seg-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.4rem;
}

.seek-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--gold-soft);
  font: 600 0.75rem/1 var(--font-body);
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
}

.seek-btn:hover {
  background: rgba(240, 194, 58, 0.12);
}

.seg-card textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-bn);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.45;
}

.style-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.style-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  row-gap: 0.15rem;
  align-items: center;
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
}

.style-card input {
  grid-row: span 2;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--gold);
}

.style-card strong {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.style-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.style-card.selected {
  border-color: rgba(240, 194, 58, 0.5);
  background: rgba(240, 194, 58, 0.08);
}

.status {
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  font-size: 0.88rem;
}

.status .bar {
  margin-top: 0.5rem;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.status .bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--mint));
  transition: width 0.25s ease;
}

.status.error { color: var(--danger); border-color: rgba(255,122,110,0.35); }
.status.ok { color: var(--ok); border-color: rgba(143,223,168,0.35); }

.exports {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.export-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.18);
}

.export-item strong {
  font-family: var(--font-display);
  text-transform: capitalize;
}

.export-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.mini-btn {
  appearance: none;
  display: inline-block;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font: 650 0.78rem/1 var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.mini-btn:hover {
  border-color: rgba(240, 194, 58, 0.5);
}

.mini-btn.gold {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-color: transparent;
  color: #1a1408;
}

.mini-link {
  color: var(--gold-soft);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  align-self: center;
}

.mini-link:hover { text-decoration: underline; }

.row.between {
  justify-content: space-between;
  align-items: center;
}

.customize {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  overflow: hidden;
}

.customize summary {
  cursor: pointer;
  padding: 0.7rem 0.85rem;
  font: 700 0.88rem/1 var(--font-body);
  color: var(--muted);
  list-style: none;
  user-select: none;
}

.customize summary::before {
  content: "◆ ";
  color: var(--gold);
  font-size: 0.6rem;
  vertical-align: middle;
}

.customize[open] summary { color: var(--ink); }

.cust-grid {
  padding: 0.4rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.cust-grid .field span {
  display: flex;
  justify-content: space-between;
}

.cust-grid .field b { color: var(--gold-soft); }

.cust-grid input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.color-field {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.color-field input[type="color"] {
  width: 3rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 0.15rem;
}

.cust-actions {
  display: flex;
  gap: 0.5rem;
}

.align-group {
  display: flex;
  gap: 0.35rem;
}

.align-btn {
  appearance: none;
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 10px;
  padding: 0.5rem 0;
  font: 650 0.8rem/1 var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.align-btn.active {
  background: rgba(240, 194, 58, 0.15);
  border-color: rgba(240, 194, 58, 0.55);
  color: var(--gold-soft);
}

.ai-btn {
  background: linear-gradient(135deg, rgba(127, 214, 176, 0.18), rgba(127, 214, 176, 0.08));
  border-color: rgba(127, 214, 176, 0.4);
  color: var(--mint);
}

.ai-btn:not(:disabled):hover {
  border-color: var(--mint);
}

.muted { color: var(--muted); }

.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.5rem;
  border-top: 1px solid var(--line);
  background: rgba(12, 10, 8, 0.9);
  backdrop-filter: blur(12px);
  color: var(--muted);
  font-size: 0.82rem;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(100%, 400px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem 1.4rem 1.35rem;
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.login-card input[type="password"] {
  background: #100e0c;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: 600 1rem/1.2 var(--font-body);
  width: 100%;
}

@media (max-width: 980px) {
  .stage {
    grid-template-columns: 1fr;
    padding-bottom: 6rem;
  }

  .player-shell {
    width: min(100%, 360px);
    max-height: 56vh;
  }

  .brand-copy span { display: none; }
}
