/* Native controls + project CSS. Radius scale: panels 16px, controls 8px. */
:root {
  color-scheme: light dark;
  --bg: #f5f7fa;
  --surface: #fdfefe;
  --surface-soft: #eaf0fa;
  --border: #d6dfe9;
  --text: #1b293e;
  --text-dim: #526278;
  --accent: #255ac9;
  --accent-hover: #1c47a4;
  --on-accent: #fff;
  --danger: #b52c39;
  --success: #237247;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121923;
    --surface: #192330;
    --surface-soft: #202f44;
    --border: #3e4e63;
    --text: #edf2fa;
    --text-dim: #afbdd0;
    --accent: #9cbeff;
    --accent-hover: #b9d0fc;
    --on-accent: #12233f;
    --danger: #ff9fa8;
    --success: #8bd8ad;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 1160px; margin: 0 auto; padding: 80px 40px 40px; }
.intro { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 64px; }
.hero h1 { max-width: 12ch; font-size: clamp(2.25rem, 4vw, 3.5rem); line-height: 1.1; font-weight: 650; letter-spacing: -.045em; text-wrap: balance; }
.tagline { max-width: 35ch; margin-top: 24px; color: var(--text-dim); font-size: 1.075rem; }
.privacy { max-width: 40ch; margin-top: 30px; padding-left: 16px; border-left: 2px solid var(--accent); font-size: .85rem; color: var(--text-dim); }
.offline-badge { margin-top: 16px; color: var(--success); font-size: .8rem; max-width: 40ch; }
.dropzone {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 38px 24px 30px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 12px 36px rgb(37 70 120 / .045);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--surface-soft); }
:where(button, select, input, [tabindex], a):focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.dropzone[aria-disabled="true"] { cursor: not-allowed; opacity: .65; }
.format-mark { display: inline-flex; flex-direction: column; justify-content: center; width: 92px; height: 104px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--accent); font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 24px; }
.format-mark span { border-top: 1px solid var(--border); padding-top: 8px; margin: 8px 10px 0; font-size: .62rem; font-weight: 600; letter-spacing: .04em; color: var(--text-dim); }
.dropzone-title { font-size: 1.25rem; font-weight: 650; letter-spacing: -.025em; }
.dropzone-sub { color: var(--text-dim); font-size: .875rem; margin-top: 6px; }
.browse-cta { display: inline-flex; align-items: center; justify-content: center; gap: 30px; margin-top: 24px; border-radius: 8px; background: var(--accent); color: var(--on-accent); padding: 11px 22px; font-weight: 600; font-size: .9rem; }
.browse-cta span { font-size: 1.15rem; }
.dropzone-formats { margin-top: 12px; font-size: .75rem; color: var(--text-dim); }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -.015em; }
.controls { margin-top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.controls-row { display: grid; grid-template-columns: 1fr 1.2fr 1fr 1.1fr; align-items: end; gap: 20px; margin-top: 14px; }
.control { display: flex; flex-direction: column; gap: 8px; font-size: .8rem; color: var(--text-dim); min-width: 0; }
.control select, .control input { font: inherit; accent-color: var(--accent); }
select { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
input[type="range"] { width: 100%; min-height: 44px; }
input[type="checkbox"] { width: 18px; height: 18px; vertical-align: middle; margin-right: 5px; }
.exif-control { min-height: 44px; justify-content: center; color: var(--text); }
.control.disabled { opacity: .55; }
.control output { float: right; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; margin-bottom: 12px; }
.btn, .file-retry, .file-download { font: inherit; font-size: .875rem; font-weight: 600; border: 1px solid var(--border); border-radius: 8px; min-height: 44px; padding: 10px 18px; cursor: pointer; background: var(--surface); color: var(--text); }
.btn:hover, .file-retry:hover, .file-download:hover { background: var(--surface-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); min-width: 132px; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
.hint { margin-top: 9px; font-size: .78rem; color: var(--text-dim); line-height: 1.65; }
#exifHint { color: var(--text); }
#overallProgress { border-top: 1px solid var(--border); padding-top: 14px; font-weight: 600; color: var(--text); }
.empty-state { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--border); }
.empty-state p { color: var(--text-dim); font-size: .875rem; margin-top: 8px; max-width: 47ch; }
.empty-state strong { color: var(--text); font-weight: 600; }
#dashboard { background: var(--surface-soft); padding: 24px; border-radius: var(--radius); margin: 24px 0 32px; font-size: .85rem; }
#batchProgress { appearance: none; display: block; width: 100%; height: 6px; margin: 16px 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--border); accent-color: var(--accent); }
#batchProgress::-webkit-progress-bar { background: var(--border); }
#batchProgress::-webkit-progress-value { background: var(--accent); border-radius: 8px; }
#batchProgress::-moz-progress-bar { background: var(--accent); }
#batchCounts { font-weight: 600; }
#batchTiming { color: var(--text-dim); margin-top: 6px; font-variant-numeric: tabular-nums; }
#activeJobs { overflow-wrap: anywhere; color: var(--accent); }
#activeJobs:not(:empty) { margin-top: 12px; }
#dashboard > label { display: flex; align-items: center; gap: 12px; margin-top: 16px; color: var(--text-dim); }
#statusFilter { width: auto; font-size: .8rem; }
.file-list { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.file-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 16px; }
.preview-box { width: 80px; height: 72px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 8px; font-size: 11px; color: var(--text-dim); text-align: center; overflow: hidden; padding: 2px; }
.preview { width: 100%; height: 100%; object-fit: contain; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { color: var(--text-dim); font-size: .75rem; font-variant-numeric: tabular-nums; }
.file-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; max-width: 46%; }
.file-status { font-size: .8rem; font-weight: 600; overflow-wrap: anywhere; }
.file-status.pending { color: var(--text-dim); }
.file-status.working, .file-download { color: var(--accent); }
.file-status.done { color: var(--success); }
.file-status.error, .file-retry { color: var(--danger); }
.footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-dim); font-size: .75rem; max-width: 72ch; }
a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
.has-files .container { padding-top: 32px; }
.has-files .intro { grid-template-columns: 1.5fr 1fr; gap: 40px; }
.has-files .tagline, .has-files .format-mark, .has-files .dropzone-formats { display: none; }
.has-files .hero h1 { font-size: 1.8rem; max-width: none; }
.has-files .privacy { margin-top: 14px; max-width: 54ch; }
.has-files .offline-badge { margin-top: 8px; max-width: none; }
.has-files .dropzone { padding: 20px; }
.has-files .dropzone-title { font-size: 1rem; }
.has-files .dropzone-sub { display: none; }
.has-files .browse-cta { margin-top: 10px; padding: 7px 14px; font-size: .8rem; }
@media (prefers-reduced-motion: no-preference) {
  .browse-cta, button { transition: transform .15s ease; }
  .dropzone:active .browse-cta, button:not(:disabled):active { transform: translateY(1px); }
}
@media (max-width: 900px) {
  .container { padding: 48px 28px 32px; }
  .intro, .empty-state { gap: 32px; }
  .controls-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .container, .has-files .container { padding: 32px 20px; }
  .intro, .has-files .intro, .empty-state { grid-template-columns: 1fr; gap: 28px; }
  .hero h1 { max-width: 16ch; font-size: 2.4rem; }
  .tagline { margin-top: 16px; }
  .privacy { margin-top: 18px; max-width: none; }
  .dropzone { padding: 24px 16px; }
  .format-mark { width: 68px; height: 76px; margin-bottom: 16px; font-size: 1rem; }
  .format-mark span { font-size: .5rem; margin-top: 4px; padding-top: 4px; }
  .browse-cta { margin-top: 18px; }
  .empty-state { margin-top: 32px; padding-top: 24px; gap: 24px; }
  .controls { padding: 20px; }
  .controls-row { gap: 16px; }
  .action-row .btn { flex: 1 1 auto; }
  .file-item { flex-wrap: wrap; padding: 12px; gap: 12px; }
  .file-actions { max-width: none; width: 100%; justify-content: flex-start; }
  .file-status { margin-right: auto; }
  .footer { margin-top: 36px; }
  #dashboard { padding: 20px; }
}
@media (max-width: 380px) {
  .controls-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.1rem; }
}
[hidden] { display: none !important; }
/* Private HEIC identity: restrained typography, local-processing message first. */
.brand-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 64px; }
.wordmark { font-size: 1.1rem; font-weight: 750; letter-spacing: -.045em; }
.wordmark span { margin-left: 5px; font-weight: 450; color: var(--text-dim); }
.hero h1 { max-width: 10ch; }
.footer-domain { color: var(--text); font-weight: 600; margin-bottom: 8px; }
.has-files .brand-bar { margin-bottom: 28px; }
.has-files .hero h1 { max-width: none; }
@media (max-width: 767px) {
  .brand-bar { margin-bottom: 36px; }
  .hero h1 { max-width: 16ch; }
}

/* Keep advanced explanations out of the primary conversion flow. */
.conversion-details { margin-top: 10px; }
.conversion-details summary { width: fit-content; min-height: 32px; padding: 5px 0; color: var(--text-dim); font-size: .78rem; cursor: pointer; }
.conversion-details summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.conversion-details[open] { padding-bottom: 8px; }
#clearBtn { border-color: transparent; background: transparent; color: var(--text-dim); }
#clearBtn:hover { color: var(--text); background: var(--surface-soft); }
#exifHint { color: var(--text-dim); }
@media (max-width: 767px) {
  .controls { padding: 16px; }
  .controls-row { gap: 10px 16px; }
  .action-row { gap: 8px; }
  .action-row #clearBtn { flex: 0 1 auto; }
}
.controls-row { align-items: start; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.control-note { font-size: .72rem; font-weight: 400; color: var(--text-dim); line-height: 1.5; }
.format-control { border: 0; min-width: 0; }
.format-control legend { padding: 0; margin-bottom: 8px; }
.format-options { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 3px; }
.format-options label { position: relative; cursor: pointer; }
.format-options input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.format-options span { display: block; text-align: center; padding: 7px; border-radius: 5px; color: var(--text-dim); font-weight: 600; }
.format-options input:checked + span { background: var(--accent); color: var(--on-accent); }
.format-options input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 3px; }
.format-control:disabled { opacity: .5; }
.format-control:disabled input { cursor: not-allowed; }
.exif-control { padding-top: 30px; }
@media (max-width: 900px) { .controls-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 380px) { .controls-row { grid-template-columns: 1fr; } .exif-control { padding-top: 0; } }

.destination-row { display: flex; align-items: center; gap: 24px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
#destinationOptions { width: 220px; flex-shrink: 0; }
#folderChoice { display: flex; gap: 12px; align-items: center; min-width: 0; font-size: .8rem; }
#folderName { overflow-wrap: anywhere; }
#saveFolderBtn { flex-shrink: 0; }
@media(max-width: 767px) { .destination-row { flex-direction: column; align-items: stretch; gap: 12px; } #destinationOptions { width: 100%; } }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#statusFilter { border: 0; padding: 0; margin-top: 12px; width: fit-content; max-width: 100%; }
#statusFilter .format-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#statusFilter .format-options label > span { padding: 8px 14px; white-space: nowrap; font-size: .8rem; }
#statusFilter .format-options span span { display: inline; padding: 0; color: inherit; font-weight: inherit; }
@media(max-width: 600px) { #statusFilter { width: 100%; } #statusFilter .format-options { grid-template-columns: repeat(2,minmax(0,1fr)); } }
#fileListSection { margin-top: 24px; }

/* Step markers share one baseline; Quality keeps its slot to avoid layout jumps. */
.step-heading { display: flex; align-items: center; gap: 9px; min-height: 28px; color: var(--text); font-weight: 600; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 24px; border: 1px solid var(--border); border-radius: 50%; color: var(--accent); font-size: .72rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.quality-slot { min-width: 0; min-height: 80px; padding-top: 7px; }
#speedControl { padding-top: 7px; }
.exif-control { padding-top: 37px; }
.destination-row { align-items: flex-start; }
#folderChoice { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
#folderName { min-height: 28px; display: flex; align-items: center; line-height: 1.5; }
#saveFolderBtn { justify-self: start; }
#convertBtn { display: inline-flex; justify-content: center; align-items: center; gap: 10px; }
@media(max-width: 767px) { .destination-row { align-items: stretch; } }

/* Three explicit stages, with a shared number rail and dividers. */
.flow-step { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 18px; padding: 22px 0; }
.flow-step + .flow-step { border-top: 1px solid var(--border); }
.step-body { min-width: 0; }
.flow-step > .step-number { width: 38px; height: 38px; font-size: 1.05rem; background: var(--surface-soft); }
.flow-step .controls-row, .flow-step .destination-row, .flow-step .action-row { margin-top: 0; margin-bottom: 0; }
.flow-step .destination-row { padding-top: 0; border-top: 0; }
.final-step > .step-number { border-color: var(--accent); }
#convertBtn { min-height: 54px; min-width: 220px; padding: 14px 28px; font-size: 1.05rem; font-weight: 700; }
#convertBtn:not(:disabled) { box-shadow: 0 5px 14px rgb(37 90 201 / .18); }
.privacy { font-size: 1rem; font-weight: 600; line-height: 1.65; color: var(--text); }
@media(max-width: 767px) {
  .flow-step { grid-template-columns: 30px minmax(0,1fr); gap: 12px; padding: 18px 0; }
  .flow-step > .step-number { width: 30px; height: 30px; font-size: .95rem; }
  #convertBtn { min-width: 0; flex-basis: 100%; }
}
@media(max-width: 900px) { .flow-step .exif-control { padding-top: 7px; } }

.dropzone-previews { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }
.dropzone-previews img { width: min(20%, 80px); height: 68px; object-fit: contain; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.has-files .dropzone:has(.dropzone-previews:not([hidden])) .dropzone-title { font-size: .9rem; }

/* Design v2: keep native controls and the existing 16px panel / 8px control
   scale. Selected values use a tint; solid accent is reserved for actions. */
.container { padding-top: 40px; }
.brand-bar { margin-bottom: 40px; }
.intro { grid-template-columns: .9fr 1.1fr; gap: 56px; }
.hero h1 { max-width: none; font-size: clamp(2.25rem, 4vw, 3.25rem); line-height: 1.12; }
.tagline { margin-top: 18px; max-width: 34ch; }
.privacy { margin-top: 20px; }
.dropzone { padding: 28px 24px; }
.format-mark { width: 64px; height: 72px; font-size: .95rem; margin-bottom: 16px; }
.format-mark span { font-size: .5rem; margin: 5px 6px 0; padding-top: 5px; }
.browse-cta { margin-top: 18px; gap: 20px; }
.empty-state { margin-top: 40px; gap: 56px; }
.footer { max-width: none; margin-top: 36px; }
.has-files .brand-bar { margin-bottom: 16px; }
.has-files .intro { grid-template-columns: 1fr 320px; gap: 24px; }
.has-files .hero h1 { font-size: 1.4rem; }
.has-files .hero h1 br { display: none; }
.has-files .privacy { margin-top: 8px; font-size: .85rem; }
.has-files .privacy br { display: none; }
.has-files .privacy br::after { content: ' '; }
.has-files .dropzone { padding: 12px 16px; }
.has-files .browse-cta { margin-top: 6px; background: var(--surface-soft); color: var(--accent); border: 1px solid var(--border); }
.controls { margin-top: 20px; padding: 20px 24px; }
.flow-step { grid-template-columns: 30px minmax(0, 1fr); gap: 16px; padding: 14px 0; }
.flow-step > .step-number { width: 30px; height: 30px; font-size: .85rem; background: var(--bg); color: var(--text-dim); }
.final-step > .step-number { border-color: var(--border); }
.format-options input:checked + span { background: var(--surface-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.format-options label > span { min-height: 40px; }
#convertBtn { min-height: 48px; min-width: 180px; padding: 10px 24px; font-size: .95rem; }
#convertBtn:not(:disabled) { box-shadow: none; }
.conversion-details { margin-top: 0; }
.file-item { border-radius: 8px; }
@media(max-width: 900px) {
  .intro { gap: 32px; }
  .has-files .intro { grid-template-columns: 1fr 280px; }
}
@media(max-width: 767px) {
  .container, .has-files .container { padding: 24px 20px; }
  .brand-bar { margin-bottom: 24px; }
  .intro, .has-files .intro { grid-template-columns: 1fr; gap: 20px; }
  .hero h1 { font-size: 2.25rem; }
  .tagline { margin-top: 12px; font-size: 1rem; }
  .privacy { margin-top: 14px; font-size: .9rem; }
  .dropzone { padding: 20px 16px; }
  .format-mark { display: none; }
  .empty-state { gap: 24px; margin-top: 28px; }
  .has-files .intro { gap: 14px; }
  .has-files .dropzone-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .has-files .dropzone-title { font-size: .85rem; }
  .has-files .browse-cta { margin-top: 0; white-space: nowrap; }
  .has-files .browse-cta > span { display: none; }
  .controls { padding: 16px; }
  .flow-step { grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 14px 0; }
  .flow-step > .step-number { width: 26px; height: 26px; }
  #convertBtn { min-width: 0; }
}

/* Photo placeholder: Tabler photo glyph above a separate format label. */
.format-mark { position: relative; width: 88px; height: 100px; background: transparent; border: 1px solid var(--border); border-radius: 8px; align-items: center; gap: 4px; padding: 6px; }
.format-mark svg { display: block; flex-shrink: 0; width: 60px; height: 60px; color: var(--text-dim); opacity: .65; }
.format-mark b { display: block; font-size: .85rem; line-height: 1.5; }
.dropzone-formats { margin-top: 4px; }
.dropzone-sub { margin-top: 12px; }

/* Intake actions are sibling native buttons, never nested click targets. */
.intake-actions { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; }
.intake-actions .browse-cta { margin-top: 0; font-family: inherit; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.intake-actions #clearBtn { padding: 7px 10px; font-size: .8rem; white-space: nowrap; }
.has-files .intake-actions { margin-top: 6px; }
@media(max-width: 767px) {
 .has-files .dropzone-inner { display: block; }
 .has-files .intake-actions { margin-top: 8px; }
}

/* Keep selected directory beside Save to, with room for long names. */
#destinationOptions { width: 100%; }
.destination-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
#destinationOptions .format-options { max-width: 220px; }
.destination-heading { width: 100%; }
#folderName { display: inline; min-height: 0; font-size: .8rem; font-weight: 400; color: var(--text-dim); overflow-wrap: anywhere; }
#folderChoice { padding-top: 36px; align-self: start; }
@media(max-width: 767px) {
 .destination-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
 #folderChoice { padding-top: 0; }
 #destinationOptions .format-options { max-width: none; }
}
