:root {
  --bg: #f5f8fc;
  --card: #ffffff;
  --line: #dbe5f2;
  --ink: #10203b;
  --muted: #6f819b;
  --blue: #2f7ef7;
  --blue-soft: #eaf2ff;
  --green: #53b77a;
  --red: #d96d6d;
  --shadow: 0 16px 42px rgba(58, 85, 120, .11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, #ffffff 0 18%, transparent 40%),
    linear-gradient(180deg, #f8fbff, var(--bg));
}

button, select, input { font: inherit; }

button:disabled {
  opacity: .48;
  cursor: not-allowed !important;
  transform: none !important;
}

.site-header {
  width: 100%;
  padding: 18px 20px 4px;
}

.brand {
  width: min(1040px, calc(100% - 24px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #2f7ef7, #68a4ff);
  box-shadow: 0 8px 18px rgba(47, 126, 247, .25);
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand strong { font-size: 15px; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.page-shell {
  width: min(1040px, calc(100% - 24px));
  margin: 12px auto 60px;
}

.ad-slot {
  min-height: 92px;
  margin: 14px 0;
  border: 1px dashed #cdd9e9;
  border-radius: 14px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: #9aa8ba;
  background: rgba(255,255,255,.72);
}

.ad-slot span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.ad-slot div { font-size: 12px; }

.converter-card,
.how-card,
.info-card {
  background: var(--card);
  border: 1px solid #e0e8f2;
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-bar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 44px minmax(160px, 1fr) minmax(180px, .9fr);
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  background: #fbfdff;
  border-bottom: 1px solid var(--line);
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label,
.eyebrow {
  color: #5f7391;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
}

.field label span {
  float: right;
  color: var(--blue);
}

select,
.readonly-field {
  height: 42px;
  width: 100%;
  border: 1px solid #d5e1ef;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  padding: 0 12px;
  outline: none;
}

select:focus { border-color: #8fb9ff; box-shadow: 0 0 0 3px #edf4ff; }

.readonly-field {
  display: flex;
  align-items: center;
  color: #60738f;
}

.swap-icon {
  width: 44px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
}

.toolbar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 22px 16px 14px;
}

.btn {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .015em;
  transition: .16s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(47,126,247,.22); }
.btn.danger { color: #9c4f4f; background: #f6d2d2; }
.btn.convert { color: #fff; background: #61778f; min-width: 210px; }
.btn.success { color: #fff; background: var(--green); }
.btn.secondary { color: #536a84; background: #eef3f8; }

.drop-zone {
  margin: 0 32px 18px;
  min-height: 250px;
  border: 1.5px dashed #9cc2ff;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff, #ffffff);
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
  transition: .17s ease;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.dragover {
  border-color: var(--blue);
  background: #f7fbff;
}

.drop-zone.locked { cursor: default; }

.drop-placeholder {
  min-height: 248px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: center;
  padding: 20px;
}

.upload-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 22px;
  font-weight: 900;
}

.drop-placeholder strong { font-size: 17px; }
.drop-placeholder > span { color: var(--muted); font-size: 12px; }

.format-chips {
  margin-top: 6px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.format-chips span {
  padding: 5px 9px;
  border-radius: 7px;
  color: #5f7592;
  background: #edf3fb;
  font-size: 9px;
  font-weight: 850;
}

.selected-preview {
  width: 100%;
  padding: 16px;
}

.preview-media {
  width: min(760px, 100%);
  margin: 0 auto;
  border-radius: 13px;
  overflow: hidden;
  background: #0e1623;
  box-shadow: 0 8px 20px rgba(20, 35, 60, .13);
}

.preview-media video {
  display: block;
  width: 100%;
  max-height: 390px;
  background: #0e1623;
}

.preview-info {
  width: min(760px, 100%);
  margin: 12px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 12px;
  border: 1px solid #e2eaf4;
  border-radius: 12px;
  background: #fff;
}

.preview-info > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-info strong {
  max-width: 680px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.preview-info span { color: var(--muted); font-size: 10px; }

.mini-remove {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid #d9e4f1;
  border-radius: 9px;
  background: #fff;
  color: #60718b;
  cursor: pointer;
  font-size: 17px;
}

.progress-wrap {
  margin: 0 32px 18px;
  padding: 15px;
  border: 1px solid #e0e8f2;
  border-radius: 14px;
  background: #fbfdff;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
}

.progress-top span { color: var(--blue); font-weight: 850; }

.progress-track {
  height: 8px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eff6;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f7ef7, #63a2ff);
  transition: width .15s ease;
}

.progress-wrap p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.action-row {
  display: flex;
  justify-content: center;
  padding: 0 16px 20px;
}

.result-section {
  margin: 0 32px 20px;
  border: 1px solid #dbe9df;
  border-radius: 15px;
  background: #fbfffc;
  overflow: hidden;
}

.result-head {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e5efe8;
}

.result-head > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.result-head small { color: var(--muted); font-size: 10px; }

.ready-pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #3f8f5d;
  background: #e2f4e8;
  font-size: 9px;
  font-weight: 850;
}

.result-actions {
  padding: 13px 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.privacy-note {
  margin: 0;
  padding: 0 32px 22px;
  color: #8291a6;
  text-align: center;
  font-size: 9px;
  line-height: 1.5;
}

.how-card,
.info-card {
  margin-top: 16px;
  padding: 22px;
}

.how-card h2,
.info-card h2 {
  margin: 5px 0 15px;
  font-size: 20px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.steps article {
  display: flex;
  gap: 10px;
  padding: 13px;
  border: 1px solid #e4ebf4;
  border-radius: 12px;
  background: #fbfdff;
}

.steps article > span {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 11px;
  font-weight: 850;
}

.steps strong { font-size: 12px; }

.steps p,
.info-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.info-card p { max-width: 780px; font-size: 11px; }

.bottom-ad { min-height: 110px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 14px);
  z-index: 50;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: #17263b;
  box-shadow: 0 12px 28px rgba(16,32,59,.24);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 820px) {
  .settings-bar {
    grid-template-columns: 1fr 38px 1fr;
  }
  .quality-field { grid-column: 1 / -1; }
  .steps { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .page-shell,
  .brand { width: min(100% - 14px, 1040px); }
  .site-header { padding-inline: 8px; }

  .settings-bar {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .swap-icon { display: none; }

  .toolbar {
    padding-top: 16px;
    flex-wrap: wrap;
  }

  .drop-zone,
  .progress-wrap,
  .result-section {
    margin-left: 12px;
    margin-right: 12px;
  }

  .drop-zone { min-height: 220px; }
  .drop-placeholder { min-height: 218px; }

  .steps { grid-template-columns: 1fr; }

  .result-actions .btn { flex: 1 1 180px; }
}
