:root {
  --bg: #f5f9ff;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --ink: #14223a;
  --muted: #71809a;
  --line: #dfe9f7;
  --primary: #2f7df6;
  --primary-2: #5d9cff;
  --mint: #43b88d;
  --danger: #e98f8c;
  --shadow: 0 18px 50px rgba(54, 94, 151, .13);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(105, 172, 255, .16), transparent 32rem),
    radial-gradient(circle at 100% 30%, rgba(103, 222, 185, .14), transparent 28rem),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
button, select, input { font: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }

.site-header {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 19px;
  font-weight: 850;
  letter-spacing: -.03em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #77aaff);
  box-shadow: 0 8px 20px rgba(47,125,246,.25);
}
.privacy-pill {
  font-size: 12px;
  color: #32725d;
  background: #eaf9f3;
  border: 1px solid #d6f0e7;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 750;
}

main { padding: 12px 16px 72px; }
.ad-slot {
  width: min(760px, 100%);
  height: 100px;
  margin: 8px auto 28px;
  border: 1px dashed #cfdae9;
  border-radius: 14px;
  background: rgba(255,255,255,.62);
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  color: #94a1b5;
  text-align: center;
}
.ad-slot span { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; }
.ad-slot strong { font-size: 13px; font-weight: 650; }

.hero-copy {
  width: min(800px, 100%);
  margin: 0 auto 22px;
  text-align: center;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .17em;
}
.hero-copy h1,
.how-to h2 {
  margin: 0;
  letter-spacing: -.04em;
  line-height: 1.05;
}
.hero-copy h1 { font-size: clamp(30px, 5vw, 44px); }
.hero-copy > p:last-child {
  max-width: 700px;
  margin: 12px auto 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.converter-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid #e6eef9;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.mode-bar {
  padding: 14px 18px;
  background: linear-gradient(180deg, #fbfdff, #f6faff);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 42px 1fr 1.2fr;
  align-items: end;
  gap: 12px;
}
.format-control label,
.quality-control label {
  display: block;
  color: #6f7f98;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.format-control select {
  width: 100%;
  height: 42px;
  border: 1px solid #dfe7f3;
  border-radius: 10px;
  background: #fff;
  padding: 0 36px 0 12px;
  color: var(--ink);
  font-weight: 750;
  outline: none;
}
.format-control select:focus,
.quality-control input:focus { outline: 3px solid rgba(47,125,246,.14); }
.format-control select:disabled { color: #6c7b91; opacity: 1; }
.swap-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: #eaf2ff;
  color: var(--primary);
  font-size: 20px;
  cursor: default;
}
.quality-control { min-width: 0; }
.quality-topline { display: flex; justify-content: space-between; gap: 12px; }
.quality-control output { font-size: 12px; font-weight: 850; color: var(--primary); }
.quality-control input { width: 100%; accent-color: var(--primary); cursor: pointer; }

.action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 22px 18px 14px;
}
.btn {
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 9px 20px rgba(47,125,246,.22); }
.btn-soft { background: #f6d3d2; color: #8b4946; }
.btn-convert { background: #536578; color: white; }
.btn-download { background: #a9dfc3; color: #215b47; }

.drop-zone {
  margin: 0 48px 18px;
  min-height: 168px;
  border: 1.5px dashed #a9c8ff;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(249,252,255,.8), #ffffff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  transition: border .2s ease, background .2s ease, transform .2s ease;
  outline: none;
}
.drop-zone:hover,
.drop-zone:focus,
.drop-zone.dragover {
  border-color: var(--primary);
  background: #f7fbff;
  transform: translateY(-1px);
}
.upload-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf5ff;
  color: var(--primary);
  font-size: 23px;
  font-weight: 900;
}
.drop-zone strong { font-size: 17px; }
.drop-zone > span { color: var(--muted); font-size: 13px; }
.format-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 7px; }
.format-chips span {
  padding: 4px 7px;
  border-radius: 7px;
  background: #eef4fb;
  color: #6b7890;
  font-size: 10px;
  font-weight: 850;
}

.summary-bar {
  margin: 0 48px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4f8fd;
  color: #667791;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.file-list {
  margin: 0 48px;
  max-height: 316px;
  overflow: auto;
}
.file-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 11px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid #edf2f8;
}
.thumb {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: #eef3f8;
  object-fit: cover;
  border: 1px solid #e4eaf2;
}
.file-meta { min-width: 0; }
.file-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 780;
}
.file-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.status {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0f4f8;
  color: #728096;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.status.working { color: #8a621d; background: #fff4d8; }
.status.done { color: #2d775e; background: #e7f8f1; }
.status.error { color: #a6514d; background: #ffe9e7; }
.row-actions { display: flex; gap: 5px; }
.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #e2e9f3;
  background: #fff;
  border-radius: 9px;
  color: #5e6b7e;
  cursor: pointer;
}
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn:hover:not(:disabled) { border-color: #bdd2f1; color: var(--primary); }

.bottom-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 18px 18px 8px;
}
.tool-note {
  margin: 8px 48px 24px;
  color: #8794a7;
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.ad-bottom { margin-top: 30px; margin-bottom: 42px; }
.how-to { width: min(960px, 100%); margin: 0 auto; text-align: center; }
.how-to h2 { font-size: clamp(26px, 4vw, 36px); }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
  text-align: left;
}
.steps-grid article {
  min-height: 174px;
  background: rgba(255,255,255,.86);
  border: 1px solid #e3ebf5;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(59, 92, 136, .07);
}
.steps-grid article > span {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #eaf2ff;
  color: var(--primary);
  font-weight: 900;
}
.steps-grid h3 { margin: 14px 0 7px; font-size: 15px; }
.steps-grid p, .info-box p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.info-box {
  margin-top: 14px;
  text-align: left;
  background: #f3fbf7;
  border: 1px solid #d9eee4;
  border-radius: 15px;
  padding: 16px 18px;
}
.info-box strong { display: block; margin-bottom: 5px; color: #2f705a; }

footer {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  border-top: 1px solid #dfe7f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #8996a9;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  background: #17283f;
  color: #fff;
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 12px 34px rgba(23,40,63,.25);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .site-header { min-height: 62px; }
  .privacy-pill { display: none; }
  main { padding-left: 10px; padding-right: 10px; }
  .ad-slot { height: 82px; }
  .mode-bar { grid-template-columns: 1fr 36px 1fr; gap: 8px; }
  .quality-control { grid-column: 1 / -1; }
  .swap-btn { width: 36px; height: 42px; }
  .action-row { padding-top: 16px; }
  .drop-zone, .summary-bar, .file-list { margin-left: 14px; margin-right: 14px; }
  .drop-zone { min-height: 190px; padding: 18px; }
  .file-row { grid-template-columns: 40px minmax(0,1fr) auto; }
  .thumb { width: 40px; height: 40px; }
  .status { display: none; }
  .tool-note { margin-left: 18px; margin-right: 18px; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
  footer { flex-direction: column; justify-content: center; gap: 4px; }
}

@media (max-width: 460px) {
  .hero-copy h1 { font-size: 31px; }
  .action-row, .bottom-actions { gap: 8px; }
  .btn { padding: 0 14px; font-size: 12px; }
  .steps-grid { grid-template-columns: 1fr; }
}


/* Selected files stay inside the drag/drop area until conversion starts. */
.drop-placeholder {
  width: 100%;
  min-height: 164px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.drop-placeholder > span {
  color: var(--muted);
  font-size: 13px;
}
.drop-zone.locked {
  cursor: default;
}
.drop-zone.locked:hover,
.drop-zone.locked:focus {
  border-color: #a9c8ff;
  background: linear-gradient(180deg, rgba(249,252,255,.8), #ffffff);
  transform: none;
}
.selected-preview {
  width: 100%;
  padding: 14px 16px 16px;
}
.selected-preview-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
  text-align: left;
}
.selected-preview-head > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.selected-preview-head strong {
  font-size: 14px;
  color: var(--ink);
}
.selected-preview-head #selectedHint,
.selected-preview-head #selectedSize {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}
.selected-preview-head #selectedSize {
  white-space: nowrap;
}
.selected-grid {
  width: 100%;
  max-height: 245px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 128px));
  justify-content: center;
  gap: 10px;
  padding: 2px;
}
.selected-card {
  min-width: 0;
  padding: 7px;
  border: 1px solid #e3ebf6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(65, 100, 145, .06);
  text-align: left;
}
.selected-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / .72;
  border-radius: 9px;
  overflow: hidden;
  background: #f1f5fa;
}
.selected-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #f6f9fd;
}
.selected-thumb-fallback,
.thumb-fallback {
  display: grid;
  place-items: center;
  color: #8b99ad;
  font-size: 10px;
  font-weight: 850;
}
.selected-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 34, 58, .82);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(20,34,58,.18);
}
.selected-name {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}
.selected-meta {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 9px;
}
@media (max-width: 760px) {
  .selected-preview { padding: 10px; }
  .selected-grid {
    grid-template-columns: repeat(auto-fit, minmax(94px, 112px));
    max-height: 300px;
  }
  .selected-preview-head { padding: 0 2px; }
}
