/* ── Controls bar ───────────────────────────────────────────────────────── */
.cbar {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  transition: background .2s, border-color .2s;
}

.btn-p { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-p:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* CSS-drawn pause bars — no emoji, works on all platforms */
#playBtn.is-playing::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 11px;
  vertical-align: -1px;
  margin-right: 5px;
  background: linear-gradient(
    to right,
    currentColor 30%, transparent 30%,
    transparent 70%, currentColor 70%
  );
}

.csep  { flex: 1; min-width: 8px; }

.metas { display: flex; gap: 12px; flex-wrap: wrap; }
.meta  { display: flex; flex-direction: column; gap: 1px; }
.mk    { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.mv    { font-family: var(--mono); font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Export bar ─────────────────────────────────────────────────────────── */
.ebar {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  transition: background .2s, border-color .2s;
}

.elbl {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-right: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Shared select + input styling for export bar */
.esel,
.einput {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.esel       { padding-right: 4px; }
.esel:hover,
.einput:hover { border-color: var(--accent); }
.esel:focus,
.einput:focus { outline: none; border-color: var(--accent); }

/* Custom dimension inputs */
.ecustom {
  display: none;
  align-items: center;
  gap: 4px;
}
.ecustom.visible { display: flex; }
.einput          { width: 68px; text-align: center; }
.edim-sep        { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* Export buttons */
.ebtn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  font-size: 10px;
  font-family: var(--mono);
  cursor: pointer;
  color: var(--text);
  transition: all .12s;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ebtn:hover      { background: var(--hover-bg); }
.ebtn.active     { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.ebtn.loading    { opacity: .5; cursor: wait; pointer-events: none; }
/* Scrollable options wrapper inside ebar — scrollable on mobile, flex row on desktop */
.ebar-opts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.ebtn-export     { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); margin-left: auto; flex-shrink: 0; }
.ebtn-export:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ── Canvas preview overlay ─────────────────────────────────────────────── */
.vid-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 10;
}
.vid-overlay.show { opacity: 1; }

/* The box itself — accurately represents the export canvas bounds.
   box-shadow creates a dim mask over everything outside the frame so
   users can see exactly which content will be clipped in the export. */
.vid-overlay::before {
  content: '';
  display: block;
  /* Pixel dimensions set via JS: overlay.style.setProperty('--box-w') / --box-h */
  width:  var(--box-w, 80%);
  height: var(--box-h, 56.25%);
  /* Crisp solid border for the canvas edge */
  border: 2px solid rgba(255,255,255,.9);
  /* Large box-shadow = dim mask outside the frame */
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.4);
  border-radius: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative;
  z-index: 11;
}
/* Resolution label — centred just below the canvas frame */
.vid-overlay::after {
  content: attr(data-label);
  position: absolute;
  /* Positioned below the box by the JS-set --box-h; falls back to a sensible %  */
  top: calc(50% + var(--box-h, 56.25%) / 2 + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.9);
  background: rgba(0,0,0,.55);
  padding: 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
  z-index: 11;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  opacity: 0;
  transform: translateY(6px);
  transition: all .2s ease;
  pointer-events: none;
  z-index: 999;
  max-width: calc(100vw - 40px);
}
.toast.on { opacity: 1; transform: translateY(0); }

/* ── Export canvas (off-screen) ─────────────────────────────────────────── */
#exportCanvas { position: fixed; top: -9999px; left: -9999px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .cbar {
    padding: 8px 12px;
    gap: 5px;
  }
  .metas {
    order: -1;
    flex: 1 0 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .csep { display: none; }
  .mv   { font-size: 10px; }
  .ebar { padding: 7px 12px; flex-wrap: nowrap; }
  .ebar-opts { overflow-x: auto; -webkit-overflow-scrolling: touch; flex: 1; min-width: 0; }
  .ebar-opts::-webkit-scrollbar { display: none; }
  .elbl { display: none; }
  .ebtn-export { margin-left: 0; flex-shrink: 0; }
}
