/* ============================================================
   DVR Race Timer — Styles
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --bg-card:     #1a1d27;
  --bg-input:    #12141c;
  --border:      #2a2d3e;
  --accent:      #4f8ef7;
  --accent-dark: #3a6fd6;
  --green:       #2ecc71;
  --red:         #e74c3c;
  --yellow:      #f1c40f;
  --text:        #e2e5f0;
  --text-dim:    #7a7f9a;
  --fastest-bg:  rgba(46,204,113,.13);
  --fastest-border: #2ecc71;
  --selected-bg: rgba(79,142,247,.15);
  --radius:      8px;
  --shadow:      0 2px 12px rgba(0,0,0,.4);
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- Layout ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--accent);
}

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 16px;
  padding: 16px;
  flex: 1;
  align-items: start;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* ---------- Upload area ---------- */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--bg-card);
}

.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(79,142,247,.05);
}

.upload-inner {
  text-align: center;
  color: var(--text-dim);
  padding: 32px;
}

.upload-inner svg { margin-bottom: 16px; opacity: .5; }

.upload-inner p { margin-bottom: 8px; }
.upload-hint { font-size: 12px; opacity: .6; line-height: 1.6; }

.file-label {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

#file-input { display: none; }

/* ---------- Transcode progress overlay ---------- */
.transcode-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.transcode-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  max-width: 340px;
}
.transcode-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.transcode-status { font-size: 0.9rem; color: var(--text); margin: 0; }
.transcode-hint   { font-size: 0.75rem; color: var(--text-dim); margin: 0; }

.transcode-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.transcode-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* ---------- Video container ---------- */
.video-container { display: flex; flex-direction: column; gap: 10px; }

/* The wrapper is locked to the loaded video's exact aspect ratio (--va is set
   from videoWidth/videoHeight on load). With no letterbox bars, the draggable
   overlay can't be parked over a black margin and then land off-frame in the
   render — the on-screen frame and the exported frame are the same rectangle.
   max-width caps the height (height = width / aspect) without reintroducing
   bars: the box just shrinks while keeping its aspect. */
.video-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  line-height: 0;
  aspect-ratio: var(--va, 16 / 9);
  width: 100%;
  max-width: calc(var(--player-max-h, 440px) * var(--va, 1.7778));
  margin-inline: auto;
}

#main-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

/* ---------- LiveSplit-style timer overlay ---------- */
.ls-timer {
  /* Customisable via the toolbar colour pickers (also passed to the export
     renderer so burned-in frames match exactly). */
  --timer-accent: #00e060;
  --timer-text:   #ffffff;
  --timer-font:   'Courier New', 'Roboto Mono', monospace;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  cursor: grab;
  user-select: none;
  font-family: var(--timer-font);
  font-size: 14px;           /* scale anchor — all em values inside use this */
  background: rgba(6, 7, 10, 0.90);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--timer-accent);
  box-shadow: 0 4px 24px rgba(0,0,0,0.75), inset 0 1px 0 rgba(255,255,255,0.04);
  border-radius: 0 2px 2px 0;
}
.ls-timer:active { cursor: grabbing; }

.ls-display {
  display: flex;
  align-items: baseline;
  padding: 5px 14px 5px 11px;
  line-height: 1;
  white-space: nowrap;
  gap: 0;
}

.ls-main {
  font-size: 2.8em;
  font-weight: 700;
  color: var(--timer-text);
  letter-spacing: -0.03em;
  text-shadow: 0 0 28px color-mix(in srgb, var(--timer-accent) 18%, transparent);
}

.ls-frac {
  font-size: 1.65em;
  font-weight: 700;
  color: rgba(195, 210, 220, 0.70);
  letter-spacing: -0.02em;
}

/* Splits list below main time */
.ls-splits {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 2px 14px 4px 11px;
}

.ls-split-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 1px 0;
  line-height: 1.3;
}

.ls-split-num {
  font-size: 0.88em;
  color: rgba(130,148,165,0.65);
  min-width: 2em;
}

.ls-split-time {
  font-size: 1.1em;
  font-weight: 700;
  color: rgba(195,212,225,0.88);
  letter-spacing: -0.02em;
}

/* Current (in-progress) split highlighted in gold */
.ls-split-row.ls-split-current .ls-split-num { color: rgba(255,225,70,0.65); }
.ls-split-row.ls-split-current .ls-split-time { color: #ffe040; }

/* Fastest consecutive laps row in the overlay */
.ls-fastest {
  border-top: 1px solid color-mix(in srgb, var(--timer-accent) 25%, transparent);
  padding: 6px 14px 7px 11px;
  margin-top: 2px;
  font-size: 0.9em;
  font-weight: 700;
  color: var(--timer-accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--timer-accent) 90%, transparent),
               0 0 20px color-mix(in srgb, var(--timer-accent) 55%, transparent);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Fastest laps highlighted in splits list */
.ls-split-row.ls-split-fastest .ls-split-num { color: color-mix(in srgb, var(--timer-accent) 70%, transparent); }
.ls-split-row.ls-split-fastest .ls-split-time {
  color: var(--timer-accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--timer-accent) 85%, transparent),
               0 0 18px color-mix(in srgb, var(--timer-accent) 45%, transparent);
}

/* Resize grip — bottom-right corner triangle */
.ls-resize-grip {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: se-resize;
}
.ls-resize-grip::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255,255,255,0.30);
  border-bottom: 2px solid rgba(255,255,255,0.30);
}

/* ---------- Video toolbar ---------- */
.video-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;          /* wrap on narrow widths instead of overflowing the page */
  gap: 10px 16px;
  padding: 0 2px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  user-select: none;
}

.toggle-label input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- Overlay colour pickers ---------- */
.overlay-colors { display: flex; align-items: center; gap: 12px; }

.color-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.color-field input[type=color] {
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-input);
  cursor: pointer;
}
.color-field input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-field input[type=color]::-webkit-color-swatch { border: none; border-radius: 3px; }
.color-field input[type=color]::-moz-color-swatch { border: none; border-radius: 3px; }

/* ---------- Time readout ---------- */
.time-readout {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.time-display {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

.time-current {
  color: var(--text);
  font-size: 15px;
}

.time-readout-sep { color: var(--text-dim); }

/* ---------- Trim timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 6px; }

.timeline-track {
  position: relative;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  user-select: none;
  touch-action: none;
  cursor: pointer;
}

/* Filmstrip — equal-width cells, each holds one thumbnail */
.timeline-strip { position: absolute; inset: 0; display: flex; }

.tl-cell {
  flex: 1 1 0;
  min-width: 0;
  background-color: #14161f;
  background-size: cover;
  background-position: center;
  border-right: 1px solid rgba(0,0,0,.35);
}
.tl-cell:last-child { border-right: none; }
.tl-cell.filled { background-color: transparent; }

/* Dim the trimmed-away regions */
.tl-shade {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(8,9,14,.72);
  pointer-events: none;
  z-index: 1;
}
.tl-shade-left  { left: 0; }
.tl-shade-right { right: 0; }

/* Accent border around the kept range */
.tl-region {
  position: absolute;
  top: 0; bottom: 0;
  border: 2px solid var(--accent);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
  pointer-events: none;
  z-index: 2;
}

/* In/out handles straddling the boundaries */
.tl-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 14px;
  margin-left: -7px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  touch-action: none;
  z-index: 4;
}
.tl-handle span {
  width: 2px;
  height: 42%;
  background: rgba(255,255,255,.85);
  border-radius: 1px;
}
.tl-handle::after {              /* widen the hit target without resizing the bar */
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -6px; right: -6px;
}
.tl-handle:hover { background: var(--accent-dark); }
.tl-handle-left  { border-radius: 4px 0 0 4px; }
.tl-handle-right { border-radius: 0 4px 4px 0; }

/* Playhead — current position */
.tl-playhead {
  position: absolute;
  top: -1px; bottom: -1px;
  width: 2px;
  margin-left: -1px;
  background: var(--red);
  box-shadow: 0 0 6px rgba(231,76,60,.9);
  pointer-events: none;
  z-index: 3;
}

/* Lap markers — a tick at every lap boundary (start of each lap + race end),
   purely visual; clicks fall through to the track to seek. */
.tl-markers { position: absolute; inset: 0; pointer-events: none; z-index: 2; }

.tl-marker {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--yellow);
  box-shadow: 0 0 4px rgba(0,0,0,.55);
}

.tl-marker-flag {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--yellow);
  color: #14161f;
  font: 700 9px/1 'Segoe UI', system-ui, sans-serif;
  padding: 2px 4px;
  border-radius: 0 0 3px 3px;
  white-space: nowrap;
}

/* Race-end boundary (the final lap's end) — distinct from lap starts */
.tl-marker-end { background: var(--green); }
.tl-marker-end .tl-marker-flag { background: var(--green); }

.timeline-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.tl-range-label { font-family: 'Courier New', monospace; color: var(--text); }
.tl-hint { opacity: .7; }
#btn-trim-reset { margin-left: auto; }
#btn-trim-reset:disabled { opacity: .4; cursor: default; }

/* ---------- Controls row ---------- */
.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.playback-controls { display: flex; align-items: center; gap: 4px; }

.speed-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.speed-label { color: var(--text-dim); font-size: 13px; }

/* ---------- Shortcut hint ---------- */
.shortcut-hint {
  font-size: 11px;
  color: var(--text-dim);
  opacity: .7;
  padding: 0 2px;
}

.shortcut-hint kbd {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 10px;
  color: var(--text);
}

/* ---------- Buttons ---------- */
.btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
  outline: none;
  font-family: inherit;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: scale(.97); }

/* Disabled buttons: muted, non-interactive, no hover/press feedback */
.btn:disabled {
  opacity: .4;
  cursor: default;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
.btn-danger:hover { background: rgba(231,76,60,.1); }

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn-success:hover { background: #27ae60; border-color: #27ae60; }

.btn-icon {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--border); }

.btn-play {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 7px 10px;
}
.btn-play:hover { background: var(--accent-dark); }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ---------- Inputs / selects ---------- */
.input-sm, .select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.input-sm:focus, .select-sm:focus { border-color: var(--accent); }
.input-sm { width: 64px; text-align: center; }

/* ---------- Laps panel ---------- */
.laps-panel { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Fastest settings ---------- */
.fastest-settings h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--green); }

.fastest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fastest-summary {
  font-family: 'Courier New', monospace;
  color: var(--green);
  font-size: 13px;
  margin-left: auto;
}

/* ---------- Lap table ---------- */
.lap-table-wrapper h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lap-count {
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
}

.no-laps-msg {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 24px 8px;
  line-height: 1.7;
}

.no-laps-msg kbd {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 11px;
}

.lap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lap-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.lap-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(42,45,62,.5);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  vertical-align: middle;
}

.lap-table tr:last-child td { border-bottom: none; }

.lap-table .lap-actions { font-family: inherit; white-space: nowrap; }

.lap-row { cursor: pointer; transition: background .1s; }
.lap-row:hover { background: rgba(255,255,255,.03); }
.lap-row.selected { background: var(--selected-bg); }

/* Brief flash on a freshly-marked lap so it's noticeable when the user's eyes
   are on the video, not the table. */
.lap-row.just-added { animation: lap-flash 0.9s ease-out; }
@keyframes lap-flash {
  0%   { background: rgba(79,142,247,.45); }
  100% { background: transparent; }
}
.lap-row.fastest { background: var(--fastest-bg); }
.lap-row.fastest td:first-child { border-left: 3px solid var(--fastest-border); }

.lap-num {
  font-weight: 700;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
}

.btn-lap-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: background .1s, color .1s;
  font-family: inherit;
}
.btn-lap-action:hover { background: var(--border); color: var(--text); }
.btn-lap-action.delete:hover { background: rgba(231,76,60,.15); color: var(--red); }
.btn-lap-action.seek:hover { background: rgba(79,142,247,.15); color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 300px;
  box-shadow: var(--shadow);
}

.modal h3 { margin-bottom: 16px; font-size: 16px; }

.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.modal-field input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 14px;
  font-family: monospace;
  outline: none;
}
.modal-field input:focus { border-color: var(--accent); }

.modal-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 10px;
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---------- DroneDash import ---------- */
.lap-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lap-table-header h3 { margin-bottom: 0; }

.modal-wide { width: min(460px, 92vw); }

.dd-dim { color: var(--text-dim); font-weight: 400; }

.dd-meeting-name {
  font-size: 12px;
  color: var(--green);
  margin-top: 6px;
  min-height: 15px;
}

.dd-select { width: 100%; }
.dd-select:disabled { color: var(--text-dim); }

/* Searchable race dropdown */
.dd-combo { position: relative; }

.dd-combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.dd-combo-row {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dd-combo-row:last-child { border-bottom: none; }
.dd-combo-row:hover, .dd-combo-row.active { background: var(--selected-bg); }

.dd-combo-label { display: block; font-size: 13px; }

.dd-combo-sub {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dd-combo-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.dd-radio {
  display: block !important;
  font-size: 13px !important;
  color: var(--text) !important;
  margin: 6px 0 0 !important;
  cursor: pointer;
}
/* Undo the generic .modal-field input { width:100% } for radios/checkboxes —
   a full-width radio pushes its dot to the row centre. */
.dd-radio input {
  width: auto;
  margin-right: 7px;
  vertical-align: -1px;
}

.dd-preview {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 10px;
  margin-bottom: 14px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}
.dd-preview-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.dd-preview-total {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 5px;
  color: var(--green);
}

/* Fastest consecutive-laps highlight in the import preview — same green
   treatment as the lap table's .fastest rows. */
.dd-preview-row.dd-fastest {
  background: var(--fastest-bg);
  box-shadow: inset 3px 0 0 var(--fastest-border);
  padding-left: 7px;
}
.dd-preview-fastest { color: var(--fastest-border); }

/* ---------- Help button + tutorial ---------- */
.btn-help {
  border-radius: 50%;
  width: 30px;
  height: 30px;
  padding: 0;
  font-weight: 700;
  flex: 0 0 auto;
}

.tutorial-modal {
  width: min(430px, 92vw);
  position: relative;
}

.tutorial-skip {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: inherit;
  padding: 3px 10px;
  cursor: pointer;
}
.tutorial-skip:hover { background: var(--border); color: var(--text); }

.tutorial-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  min-height: 88px;
}
.tutorial-body strong { color: var(--text); }
.tutorial-body kbd {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 11px;
  color: var(--text);
}

.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.tutorial-dots { display: flex; gap: 6px; }

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
}
.tutorial-dot:hover { background: var(--text-dim); }
.tutorial-dot.active { background: var(--accent); }

.tutorial-nav { display: flex; gap: 8px; }

/* ---------- Export progress toast ---------- */
.export-progress {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
  font-size: 13px;
}

.export-progress-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.export-progress-body { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }

/* Determinate progress bar — only shown for the background (ffmpeg) export,
   which reports real percentages. The WebCodecs path leaves it hidden. */
.export-progress-track { display: none; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.export-progress.ffmpeg-mode .export-progress-track { display: block; }
#export-progress-bar { height: 100%; width: 0; background: var(--green); transition: width 0.25s ease; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: minmax(0, 1fr);  /* min 0 so children can shrink, never overflow the page */
  }
  .header-actions { gap: 6px; }
  .app-header h1 { font-size: 15px; }
}

@media (max-width: 540px) {
  .app-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .controls-row { flex-direction: column; align-items: flex-start; }
  .speed-controls { margin-left: 0; }
}
