@font-face {
  font-family: 'GM Sans';
  src: url('https://www.theglobeandmail.com/files/dev/www/cache-long/fonts/GMsans-Web-Regular.woff2?v=3') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'GM Sans Label';
  src: url('https://www.theglobeandmail.com/files/dev/www/cache-long/fonts/GMsans-Web-Label.woff2?v=3') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Pratt';
  src: url('https://www.theglobeandmail.com/files/dev/www/cache-long/fonts/Pratt-Nova.woff2?v=3') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Pratt';
  src: url('https://www.theglobeandmail.com/files/dev/www/cache-long/fonts/Pratt-Bold.woff2?v=3') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg:           #ffffff;
  --card:         #fafafa;
  --card2:        #f2f2f2;
  --ink:          #1a1a1a;
  --muted:        #595959;
  --accent:       #b21000;
  --accent-hover: #8a0d00;
  --line:         #d4d4d4;
  --radius:       0px;
  --radius-sm:    0px;
  --gap:          16px;
  --success:      #2e7d32;
  --error:        #cc0000;
  --code-bg:      #f2f2f2;
  --code-text:    #1a1a1a;

  --serif: 'Pratt', Georgia, 'Times New Roman', serif;
  --sans:  'GM Sans', 'Helvetica Neue', Arial, sans-serif;
  --label: 'GM Sans Label', 'GM Sans', 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────── */
.app-header {
  border-bottom: 4px solid var(--ink);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

@media (min-width: 768px) {
  .app-header { gap: 24px; }
}

.app-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  margin: 0;
}

.app-title span {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 6px;
}

.tabs {
  display: flex;
  gap: 2px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--label);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 11px;
  transition: color .15s, background .15s;
}

.tab-btn:hover { color: var(--ink); background: var(--card2); }
.tab-btn.active { color: var(--accent); background: var(--card2); font-weight: 600; }

.wrap { max-width: 900px; margin: 0 auto; padding: 28px 20px; }

/* ── Card ────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--gap);
}

/* ── Preset chips ────────────────────────────── */
.chips-label {
  font-family: var(--label);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--label);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: border-color .15s, color .15s, background .15s;
}

.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.active { border-color: var(--accent); background: var(--accent); color: #fff; }

/* ── Calculator panel ────────────────────────── */
#panel-calc { display: none; }
#panel-calc.visible { display: block; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.field input:focus { border-color: var(--accent); }
.field input:disabled { background: var(--card2); color: var(--muted); border-style: dashed; cursor: not-allowed; }
.field input.err { border-color: var(--accent); }

.err-msg { color: var(--accent); font-size: 12px; min-height: 16px; margin-top: 4px; }

.flip-wrap { display: flex; align-items: flex-end; padding-bottom: 22px; }

.icon-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  padding: 9px 12px;
  transition: border-color .15s;
}
.icon-btn:hover { border-color: var(--accent); }

.calc-result {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.result-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.result-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

.result-value.copyable { cursor: pointer; }
.result-value.copyable:hover { color: var(--accent); }
.result-value.copied { color: var(--accent); }

.result-value.copyable::after {
  content: "  click to copy";
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}
.result-value.copyable:hover::after { color: var(--accent); }
.result-value.copied::after { content: ""; }

.btn-row { margin-top: 16px; display: flex; gap: 8px; }

.text-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  padding: 7px 14px;
  transition: border-color .15s;
}
.text-btn:hover { border-color: var(--accent); }

.reference-visual {
  margin-top: 28px;
}

.reference-visual h3 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.reference-visual img {
  width: 100%;
  max-width: 530px;
  height: auto;
  display: block;
}

/* ── Crop panel ──────────────────────────────── */
#panel-crop { display: none; }
#panel-crop.visible { display: block; }

.crop-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--gap);
  align-items: start;
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
  overflow: hidden;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.dropzone:hover,
.dropzone.dragover,
.dropzone.drag-over { border-color: var(--accent); background: rgba(178,16,0,.04); }

.dropzone svg { opacity: .4; }

.dropzone-hint { font-size: 12px; color: var(--muted); opacity: .7; }

/* Canvas wrapper */
.canvas-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  line-height: 0;
}

#cropCanvas {
  width: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
  max-height: 70vh;
}

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 14px; }

.sidebar-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }

.res-options { display: flex; flex-direction: column; gap: 6px; }
.res-option { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.res-option input[type=radio] { accent-color: var(--accent); }

.custom-ratio-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.custom-ratio-row input {
  width: 54px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  text-align: center;
}
.custom-ratio-row input:focus { border-color: var(--accent); }
.custom-ratio-row span { color: var(--muted); font-size: 14px; font-weight: 600; }

.custom-res-wrap { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.custom-res-wrap input[type=number] {
  width: 80px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.custom-res-wrap input:focus { border-color: var(--accent); }
.custom-res-wrap span { font-size: 12px; color: var(--muted); }

.export-btn {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: var(--label);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background .15s;
}
.export-btn:hover { background: var(--accent-hover); }
.export-btn:disabled { opacity: .4; cursor: not-allowed; }

.export-btn-secondary {
  width: 100%;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s;
  margin-top: 6px;
}
.export-btn-secondary:hover { border-color: var(--accent); }
.export-btn-secondary:disabled { opacity: .4; cursor: not-allowed; }

.crop-info {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.crop-info strong { color: var(--ink); }

/* Warn small image */
.size-warn {
  font-size: 11px;
  color: #f5a623;
  margin-top: 4px;
  display: none;
}
.size-warn.visible { display: block; }

/* ── Embed panel ─────────────────────────────── */
#panel-embed { display: none; }
#panel-embed.visible { display: block; }

/* ── Compressor panel ────────────────────────── */
#panel-compress { display: none; }
#panel-compress.visible { display: block; }

/* Service tabs (pill style, inside the embed panel) */
.svc-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.svc-btn {
  padding: 5px 14px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--label);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.svc-btn:hover { border-color: var(--accent); color: var(--ink); }
.svc-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.svc-panel { display: none; }
.svc-panel.active { display: block; }

/* Embed card */
.e-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--gap);
}

.e-card label {
  display: block;
  font-family: var(--label);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 6px;
}

.e-card input[type="text"],
.e-card input[type="url"],
.e-card textarea,
.e-card select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.e-card input:focus,
.e-card textarea:focus,
.e-card select:focus { border-color: var(--accent); }

.e-card textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px;
}

.e-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.e-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 12px;
}
.e-field { flex: 1; }
.e-field label { margin-bottom: 5px; }

.e-color-field { flex: 0 0 auto; }
.e-color-field label { display: block; margin-bottom: 5px; }
input[type="color"] {
  width: 44px;
  height: 35px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
}

.e-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  align-items: center;
}
.e-swatch-label { font-size: 13px; color: var(--muted); white-space: nowrap; opacity: .8; }
.e-swatch {
  width: 22px;
  height: 22px;
  border-radius: 0;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  flex-shrink: 0;
  position: relative;
}
.e-swatch:hover { transform: scale(1.18); box-shadow: 0 0 0 2px var(--accent); z-index: 1; }
.e-swatch--active {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(178,16,0,.25);
  transform: scale(1.15);
  z-index: 1;
}

.e-float-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.e-float-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.e-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--label);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.e-btn-primary { background: var(--accent); color: #fff; }
.e-btn-primary:hover { background: var(--accent-hover); }
.e-btn-copy { background: var(--card2); color: var(--ink); border: 1px solid var(--line); }
.e-btn-copy:hover { border-color: var(--accent); color: var(--accent); }
.e-btn-copy.copied { background: var(--success); color: #fff; border-color: var(--success); }

.e-error { display: none; margin-top: 8px; font-size: 13px; color: var(--error); }
.e-error.visible { display: block; }

.e-output { display: none; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; }
.e-output.visible { display: block; }

.e-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.e-output-header span {
  font-family: var(--label);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.e-code {
  width: 100%;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--code-text);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
  padding: 10px;
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
  outline: none;
}
.e-code:focus { border-color: var(--line); }

.e-preview-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 16px 0 8px;
}
.e-preview-wrap {
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #000;
  min-height: 150px;
  overflow: hidden;
}

/* ── Compressor panel ────────────────────────── */
.cmp-layout {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  max-width: 680px;
}

.cmp-dropzone { cursor: pointer; }
.cmp-dropzone.drag-over { border-color: var(--accent); background: var(--card2); }
.cmp-dropzone.has-file .cmp-drop-text { color: var(--ink); font-weight: 500; }

.cmp-info { display: grid; }
.cmp-info-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: 13px;
}
.cmp-info-label { color: var(--muted); }

.cmp-mode-row { display: flex; gap: 20px; }

.cmp-chip-row { flex-wrap: wrap; }

.cmp-est-size {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 18px;
}

.cmp-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--card2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
}
.cmp-notice svg { flex-shrink: 0; color: var(--accent); margin-top: 1px; }
.cmp-notice p   { margin: 0; color: var(--muted); }
.cmp-notice strong { color: var(--ink); }
.cmp-notice a   { color: var(--accent); text-decoration: none; }
.cmp-notice a:hover { text-decoration: underline; }

.cmp-audio-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
}

.cmp-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cmp-progress-track {
  height: 8px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
}

.cmp-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 0;
  transition: width 0.3s ease;
}

.cmp-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.cmp-elapsed { color: var(--muted); }

/* Queue */
.cmp-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cmp-queue-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card2);
  font-size: 13px;
}

.cmp-queue-item--encoding { border-color: var(--accent); }
.cmp-queue-item--done     { opacity: .6; }
.cmp-queue-item--error    { border-color: var(--error); }

.cmp-q-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.cmp-q-size  { color: var(--muted); white-space: nowrap; }
.cmp-q-status { color: var(--muted); white-space: nowrap; min-width: 80px; text-align: right; }

.cmp-queue-item--encoding .cmp-q-status { color: var(--accent); }
.cmp-queue-item--done .cmp-q-status     { color: var(--success); }
.cmp-queue-item--error .cmp-q-status    { color: var(--error); }

.cmp-q-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: color .15s;
}
.cmp-q-remove:hover { color: var(--error); }

/* Action row */
.cmp-action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cmp-action-row .text-btn { white-space: nowrap; }

.cmp-action-row .text-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cmp-action-row .text-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.cmp-action-row .text-btn:disabled { opacity: .4; cursor: not-allowed; }

.cmp-folder-label {
  font-size: 12px;
  color: var(--success);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.cmp-speed-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

.cmp-optional {
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
}

/* ── New panel visibility ────────────────────── */
#panel-trim    { display: none; }
#panel-trim.visible    { display: block; }
#panel-redact  { display: none; }
#panel-redact.visible  { display: block; }
#panel-extract { display: none; }
#panel-extract.visible { display: block; }
#panel-palette { display: none; }
#panel-palette.visible { display: block; }

/* ── Tab permalink footer ────────────────────── */
.tab-permalink { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); text-align: right; }
.tab-permalink-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: color .15s;
}
.tab-permalink-link:hover { color: var(--accent); }

/* ── Crop preview ────────────────────────────── */
.crop-preview-wrap {
  margin-top: 16px;
}
.crop-preview-img {
  width: 100%;
  max-width: 600px;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

/* ── Trimmer ─────────────────────────────────── */
.trm-video {
  width: 100%;
  max-height: 50vh;
  background: #000;
  border-radius: var(--radius);
  display: block;
}

.trm-audio {
  width: 100%;
  margin-bottom: 8px;
}

.trm-warn {
  font-size: 13px;
  color: #f5a623;
  background: rgba(245,166,35,.08);
  border: 1px solid rgba(245,166,35,.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.trm-timeline {
  margin-top: 12px;
}

.trm-track-bg {
  position: relative;
  height: 32px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  cursor: crosshair;
}

.trm-track-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--accent);
  opacity: .25;
  pointer-events: none;
}

/* Playhead needle — bright white vertical line */
.trm-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  pointer-events: none;
  z-index: 3;
  transform: translateX(-50%);
  box-shadow: 0 0 4px rgba(0,0,0,.7);
  left: 0;
}

/* Dual-thumb range: stack two <input type=range> on top of each other */
.trm-range {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
  z-index: 4;
}

.trm-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 32px;
  background: var(--accent);
  border-radius: 0;
  cursor: ew-resize;
  pointer-events: all;
  box-shadow: 0 0 0 2px rgba(178,16,0,.3);
}

.trm-range::-moz-range-thumb {
  width: 8px;
  height: 32px;
  background: var(--accent);
  border-radius: 0;
  cursor: ew-resize;
  pointer-events: all;
  border: none;
  box-shadow: 0 0 0 2px rgba(178,16,0,.3);
}

.trm-range::-webkit-slider-runnable-track { background: transparent; }
.trm-range::-moz-range-track { background: transparent; }

.trm-timecodes {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── 3-row control grid ─────────────────────── */
.trm-controls {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 6px 8px;
  align-items: center;
  margin-top: 12px;
}

.trm-ctrl-label {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  user-select: none;
  white-space: nowrap;
}

.trm-ctrl-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Step buttons — compact monospace */
.trm-step-btn {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-family: monospace;
  padding: 5px 7px;
  min-width: 38px;
  min-height: 36px;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.trm-step-btn:hover { border-color: var(--accent); color: var(--ink); }

/* Mark In / Out / Preview — accent outline buttons */
.trm-mark-btn {
  background: var(--card2);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  min-height: 36px;
  transition: background .15s, color .15s;
}
.trm-mark-btn:hover { background: var(--accent); color: #fff; }

/* Centre action button stretches to fill remaining space */
.trm-centre-btn { flex: 1; }

/* Small keyboard badge inside mark buttons */
.trm-mark-btn kbd {
  font-size: 10px;
  background: rgba(255,255,255,.12);
  border-radius: 2px;
  padding: 0 3px;
  font-family: monospace;
  font-weight: 400;
}

/* Keyboard shortcut legend */
.trm-kbd-legend {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 2;
}
.trm-kbd-legend kbd {
  display: inline-block;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  font-family: monospace;
  font-size: 10px;
  color: var(--ink);
}

/* ── Palette extractor ───────────────────────── */
.pal-preview {
  width: 100%;
  max-width: 400px;
  height: 200px;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.pal-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.pal-swatch {
  border-radius: var(--radius);
  padding: 16px 12px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 100px;
  border: 1px solid var(--line);
  transition: transform .1s, box-shadow .1s;
}

.pal-swatch:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

.pal-hex  { font-size: 14px; font-weight: 700; font-family: monospace; }
.pal-rgb  { font-size: 11px; opacity: .75; }
.pal-hsl  { font-size: 11px; opacity: .75; }
.pal-copy-badge { font-size: 10px; opacity: .6; margin-top: auto; }

/* ── Labeller ────────────────────────────────── */
#panel-label { display: none; }
#panel-label.visible { display: block; }

/* ── Waveform Renderer ───────────────────────── */
#panel-waveform { display: none; }
#panel-waveform.visible { display: block; }
#panel-transcribe { display: none; }
#panel-transcribe.visible { display: block; }
#panel-ocr { display: none; }
#panel-ocr.visible { display: block; }

.lbl-canvas-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
}
.lbl-canvas-wrap canvas {
  width: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* Label chips — base .chip extended with colour variants */
.lbl-chip-row { flex-wrap: wrap; }

.lbl-chip-red  { border-color: #CC0000; color: #CC0000; }
.lbl-chip-red:hover { border-color: #CC0000; background: rgba(204,0,0,.12); color: #ff4444; }
.lbl-chip-red.active  { background: #CC0000; border-color: #CC0000; color: #fff; }

.lbl-chip-blue { border-color: #4472C4; color: #4472C4; }
.lbl-chip-blue:hover { border-color: #4472C4; background: rgba(68,114,196,.12); color: #6b9fe8; }
.lbl-chip-blue.active { background: #4472C4; border-color: #4472C4; color: #fff; }


/* ── Mobile base fixes ───────────────────────── */
* { -webkit-tap-highlight-color: transparent; }

/* Prevent iOS auto-zoom on input focus (font-size must be ≥16px) */
input, select, textarea { font-size: 16px; }

/* Scrollable tab bar — no wrap, no overflow clip */
.tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.tabs::-webkit-scrollbar { display: none; }

/* Minimum tap target size */
.tab-btn, .chip, .text-btn, .export-btn, .export-btn-secondary,
.icon-btn, .e-btn, .svc-btn { min-height: 44px; }

/* Dropzone height — clamp for mobile */
.dropzone { min-height: clamp(140px, 40vh, 320px); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 680px) {
  .app-header { padding: 0 14px; gap: 12px; }
  .app-title { font-size: 13px; }
  .tab-btn { font-size: 13px; padding: 0 10px; }
  .wrap { padding: 20px 14px; }

  .calc-grid { grid-template-columns: 1fr auto 1fr; gap: 8px; }

  .crop-layout { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
  .res-options { flex-direction: row; flex-wrap: wrap; }
}

/* ── Narrow / mobile ─────────────────────────── */
@media (max-width: 480px) {
  .app-header { gap: 8px; }
  .app-title { display: none; }
  .privacy-note { display: none; }
  .wrap { padding: 14px 10px; }
  .chip { padding: 4px 10px; font-size: 12px; }
  .result-value { font-size: 18px; }
  .calc-grid { gap: 6px; }

  /* Compressor/Resizer action row stacks on small screens */
  .cmp-action-row { flex-direction: column; }
  .cmp-action-row button, .cmp-action-row .export-btn, .cmp-action-row .export-btn-secondary { width: 100%; }

  /* Queue: hide size column to save space */
  .cmp-queue-item { grid-template-columns: 1fr auto auto; }
  .cmp-q-size { display: none; }

  /* Trimmer: collapse controls grid on small screens */
  .trm-controls { grid-template-columns: 40px 1fr; gap: 4px 6px; }
  .trm-step-btn { min-width: 32px; padding: 5px 4px; font-size: 10px; }

  /* Palette swatches: 2 columns on phone */
  .pal-swatches { grid-template-columns: repeat(2, 1fr); }
}

/* ── Hamburger button ──────────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--ink); padding: 6px; border-radius: 6px;
  margin-left: auto;
}
.nav-hamburger:hover { background: var(--card2); }
.nav-hamburger-label { font-size: 13px; font-weight: 600; letter-spacing: .01em; }

/* ── Nav drawer ────────────────────────────────────────────────────────────── */
.nav-drawer-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 200;
}
.nav-drawer-backdrop.open { display: block; }

.nav-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 260px;
  background: var(--card); border-left: 1px solid var(--line);
  z-index: 201; transform: translateX(100%);
  transition: transform .22s ease; overflow-y: auto;
  display: flex; flex-direction: column;
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.nav-drawer-close {
  background: none; border: none; cursor: pointer; color: var(--ink);
  padding: 4px; border-radius: 4px; font-size: 1.3rem; line-height: 1;
}
.nav-drawer-close:hover { background: var(--card2); }

.nav-drawer-item {
  display: block; width: 100%; text-align: left;
  padding: 12px 18px; background: none; border: none; border-bottom: 1px solid var(--line);
  cursor: pointer; color: var(--ink); font-family: var(--label);
  font-size: .75rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.nav-drawer-item:hover  { background: var(--card2); }
.nav-drawer-item.active { background: var(--card2); border-left: 3px solid var(--accent); color: var(--accent); }

.nav-drawer-about {
  margin-top: auto; padding: 18px 16px; border-top: 1px solid var(--line);
  font-size: .82rem; color: var(--muted); line-height: 1.55;
}
.nav-drawer-about strong { display: block; font-size: .95rem; color: var(--ink); margin-bottom: 4px; }

/* ── Embed clear button ────────────────────────────────────────────────────── */
.e-btn-clear {
  background: none; border: 1px solid var(--line); color: var(--muted);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap; font-family: inherit;
}
.e-btn-clear:hover { border-color: var(--ink); color: var(--ink); }

/* ── Trimmer save hint ─────────────────────────────────────────────────────── */
.trm-save-hint {
  margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4;
}

/* ── Show hamburger on mobile ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tabs { display: none; }
  .nav-hamburger { display: flex; align-items: center; }
}

/* ── Trimmer waveform canvas ───────────────────────────────────────────────── */
.trm-waveform {
  display: block; width: 100%; height: 56px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--card2); margin-bottom: -1px;
}

/* ── Waveform Renderer ─────────────────────────────────────────────────────── */
.wfr-layout {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
}
.wfr-sidebar {
  flex: 0 0 250px; display: flex; flex-direction: column; gap: 12px;
}
.wfr-preview-wrap {
  flex: 1; min-width: 240px;
  display: flex; flex-direction: column; align-items: center;
}
.wfr-canvas-wrap {
  position: relative; display: inline-block; line-height: 0;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  max-width: 100%;
}
.wfr-canvas {
  max-width: 100%; border-radius: var(--radius);
  background: #111; display: block;
}

/* Card sections */
.wfr-card { padding: 14px 16px; display: flex; flex-direction: column; }
.wfr-card-title {
  font-family: var(--label); font-size: .7rem; font-weight: 400; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 12px;
}

/* Drop zones */
.wfr-mini-drop {
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer; font-size: .82rem; color: var(--muted);
  text-align: center; transition: border-color .15s; user-select: none;
}
.wfr-mini-drop:hover, .wfr-mini-drop.drag-over { border-color: var(--accent); color: var(--ink); }
.wfr-mini-drop.has-file { border-color: var(--accent); color: var(--accent); }

/* Background controls row: chips + inline colour picker */
.wfr-bg-controls {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.wfr-inline-color input[type="color"] {
  width: 28px; height: 24px; border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; padding: 2px; background: none; flex-shrink: 0;
}

/* Compact wave colour row: picker inline with swatches */
.wfr-color-compact {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.wfr-color-compact > input[type="color"] {
  width: 28px; height: 24px; border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; padding: 2px; background: none; flex-shrink: 0;
}
.wfr-color-compact .e-swatches { margin-top: 0; }

/* Slider rows: label + range + value on one line */
.wfr-slider-row {
  display: flex; align-items: center; gap: 8px;
  font-size: .8rem; color: var(--muted); margin-top: 8px;
}
.wfr-slider-row > span:first-child { min-width: 52px; }
.wfr-slider-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.wfr-slider-row > span:last-child {
  min-width: 34px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: .78rem;
}

/* Advanced toggle */
.wfr-advanced-toggle {
  background: none; border: none; color: var(--muted); font-size: .8rem;
  cursor: pointer; padding: 10px 0 0; text-align: left;
  display: flex; align-items: center; gap: 5px; transition: color .15s;
}
.wfr-advanced-toggle:hover { color: var(--ink); }

/* Misc */
.wfr-optional { font-size: .72rem; color: var(--muted); font-weight: 400; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wfr-pos-labels {
  display: flex; justify-content: space-between;
  font-size: .72rem; color: var(--muted); margin-top: 2px;
}

/* Onboarding overlay */
.wfr-onboarding {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  align-items: flex-start; gap: 14px;
  background: rgba(0,0,0,.65); padding: 28px;
  border-radius: var(--radius);
}
.wfr-onboard-step {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.5); font-size: .85rem; line-height: 1.3;
}
.wfr-step-primary { color: var(--ink); font-weight: 600; }
.wfr-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: var(--muted); flex-shrink: 0;
}
.wfr-step-primary .wfr-step-num { background: var(--accent); color: #fff; }

/* Export bar */
.wfr-export-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.wfr-export-play { flex-shrink: 0; }
.wfr-export-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.wfr-export-bar .cmp-progress-wrap { flex: 1 1 100%; margin: 4px 0 0; }

.wfr-png-note {
  font-size: .75rem; color: var(--muted); margin: 2px 0 0; line-height: 1.45;
}

@media (max-width: 680px) {
  .wfr-layout { flex-direction: column; }
  .wfr-sidebar { flex: none; width: 100%; }
  .wfr-preview-wrap { width: 100%; }
}

/* ── Generic panel building blocks (Transcribe, OCR, future tools) ───── */
.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.panel-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.55;
}
.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.action-btn {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: var(--label);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background .15s;
}
.action-btn:hover { background: var(--accent-hover); }
.action-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Generic progress bar (mirrors .cmp-progress-*) */
.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.progress-track {
  height: 8px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 0;
  transition: width 0.3s ease;
  width: 0%;
}
.progress-label {
  font-size: 12px;
  color: var(--muted);
}

/* ── Shared export bar ───────────────────────────────────────────────── */
.export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ── Transcribe panel ────────────────────────────────────────────────── */
.tr-model-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  min-height: 1.5em;
}

/* Transcript header row */
.tr-transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tr-edit-hint {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

/* Editable segment text */
.tr-text[contenteditable="true"] {
  cursor: text;
  border-radius: 3px;
  outline: none;
  transition: background .12s;
}
.tr-text[contenteditable="true"]:hover {
  background: rgba(128,128,128,.07);
}
.tr-text[contenteditable="true"]:focus {
  background: rgba(128,128,128,.1);
  box-shadow: 0 0 0 2px var(--accent) inset;
  padding: 1px 3px;
}

/* Find & Replace bar */
.tr-find-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.tr-find-row {
  display: flex;
  gap: 8px;
}
.tr-find-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  min-width: 0;
}
.tr-find-input:focus {
  outline: none;
  border-color: var(--accent);
}
.tr-find-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tr-match-count {
  font-size: 12px;
  color: var(--muted);
  min-width: 72px;
}
.tr-find-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
}
.tr-find-close:hover { color: var(--ink); background: rgba(128,128,128,.12); }

/* Match highlights */
mark.tr-match {
  background: rgba(255, 213, 79, 0.55);
  color: inherit;
  border-radius: 2px;
}
mark.tr-match-current {
  background: rgba(255, 140, 0, 0.65);
  outline: 1px solid rgba(255,140,0,.8);
}
.tr-segments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 0;
}
.tr-segment {
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.tr-ts {
  flex-shrink: 0;
  min-width: 110px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  padding-top: 2px;
}
.tr-text { color: var(--ink); }

/* ── Thumbnail (inside Trimmer panel) ───────────────────────────────── */
.thumb-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.thumb-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
}
.thumb-optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.thumb-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  cursor: default;
  touch-action: none;
  margin-top: 10px;
  border: 1px solid var(--line);
}
.thumb-drag-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 12px;
}


/* ── OCR panel ───────────────────────────────────────────────────────── */
.ocr-lang-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.ocr-preview {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  border: 1px solid var(--line);
  display: block;
}
.ocr-result {
  width: 100%;
  min-height: 180px;
  padding: 10px;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card2);
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}

/* ── About button (header) ───────────────────────────────────────────────── */
.header-about-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.header-about-btn:hover { color: var(--ink); border-color: var(--ink); }

/* ── About / License modal ───────────────────────────────────────────────── */
.about-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.about-modal-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}
.about-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--card);
}
.about-modal-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.about-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
.about-modal-close:hover { background: var(--card2); }
.about-modal-body {
  padding: 24px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.about-modal-body h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink);
  margin: 20px 0 8px;
}
.about-modal-body h3:first-child { margin-top: 0; }
.about-modal-body p { margin: 0 0 10px; }
.about-modal-body strong { color: var(--ink); }
.about-modal-body a { color: var(--accent); text-decoration: none; }
.about-modal-body a:hover { text-decoration: underline; }
.about-meta {
  margin-top: 20px !important;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}


/* ── Site footer ─────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.footer-privacy { color: var(--muted); }
.footer-links { display: flex; align-items: center; gap: 8px; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color .15s; }
.footer-links a:hover { color: var(--ink); }
.footer-sep { color: var(--line); }

/* ── Auto-Redactor ──────────────────────────────────────────────────────────── */

.rd-radius-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.rd-radius-row .chips-label {
  white-space: nowrap;
  margin: 0;
}
.rd-radius-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.rd-radius-row .rd-radius-display {
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rd-layout {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  max-width: 900px;
}

.rd-file-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.rd-file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.rd-video-note {
  font-size: 12px;
  color: var(--muted);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: 14px;
}

.rd-detect-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.rd-detect-action {
  flex-shrink: 0;
  align-self: flex-end;
  white-space: nowrap;
}

#rd-canvas-wrap {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
  line-height: 0;
}

#rd-canvas {
  max-width: 100%;
  display: block;
  cursor: default;
  touch-action: none;
}

.rd-bottom-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rd-edit-btns {
  display: flex;
  gap: 8px;
  align-self: flex-end;
  flex-shrink: 0;
}

.rd-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

.rd-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.4;
}

@media (max-width: 480px) {
  .rd-detect-row  { flex-direction: column; align-items: stretch; }
  .rd-detect-action { width: 100%; }
  .rd-bottom-row  { flex-direction: column; }
  .rd-edit-btns   { align-self: flex-start; }
}

@media (max-width: 480px) {
  .site-footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}
