:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1b1b1b;
  --border: #2a2a2a;
  --red: #e11d2e;
  --red-bright: #ff3b4a;
  --red-dark: #9f1220;
  --text: #ffffff;
  --muted: #a3a3a3;
  --ok: #3ddc84;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.glow {
  position: fixed;
  inset: 0 0 auto 0;
  height: 520px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(225, 29, 46, 0.22), rgba(225, 29, 46, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }

/* ---------- En-tête ---------- */
.topbar {
  position: relative; z-index: 1;
  width: 100%; max-width: 1040px; margin: 0 auto;
  padding: 20px 20px 0;
}

.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.logo-mark { width: 34px; height: 34px; display: block; }
.logo-text { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.logo-text span { color: var(--red); }

/* ---------- Contenu ---------- */
main {
  position: relative; z-index: 1;
  width: 100%; max-width: 820px; margin: 0 auto;
  padding: 0 20px 48px; flex: 1;
}

.hero { text-align: center; padding: 56px 0 28px; }

h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 5.2vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.accent { color: var(--red); }
.lead { margin: 0 0 32px; color: var(--muted); font-size: 1.1rem; }

/* ---------- Formulaire ---------- */
.convert-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }

.field {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(225, 29, 46, 0.18);
}
.field-icon { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.field input {
  flex: 1; min-width: 0;
  padding: 19px 0;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font: inherit; font-size: 1.05rem;
}
.field input::placeholder { color: #6b6b6b; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 22px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 700; font-size: 1.05rem;
  color: var(--text); text-decoration: none; cursor: pointer;
  transition: transform .1s, background-color .15s, border-color .15s, opacity .15s;
}
.btn svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .field input:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.field input:focus-visible { outline: none; }

.btn-sub { font-weight: 500; font-size: .85rem; opacity: .8; }

.btn-mp3 { background: var(--red); }
.btn-mp3:hover:not(:disabled) { background: var(--red-bright); }
.btn-mp4 { background: transparent; border-color: var(--red); color: var(--text); }
.btn-mp4:hover:not(:disabled) { background: rgba(225, 29, 46, 0.16); }

.btn-download { background: var(--red); }
.btn-download:hover { background: var(--red-bright); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { border-color: #555; background: var(--surface-2); }

.form-error { margin: 14px 0 0; color: var(--red-bright); font-weight: 600; }

.notice { margin: 0 0 20px; padding: 12px 16px; border-radius: 10px; text-align: left; font-size: .95rem; }
.notice-error { background: rgba(225, 29, 46, 0.12); border: 1px solid var(--red-dark); color: #ffd3d7; }

.link-button {
  align-self: center;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: none; border: 0; border-radius: 8px;
  color: var(--muted); font: inherit; font-size: .95rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: #444;
  transition: color .15s;
}
.link-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link-button:hover:not(:disabled) { color: var(--text); text-decoration-color: var(--red); }
.link-button:disabled { opacity: .45; cursor: not-allowed; }
.link-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Cartes ---------- */
.card {
  margin: 8px 0 28px; padding: 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
}
.card-success { border-color: rgba(61, 220, 132, 0.45); }
.card-error { border-color: var(--red-dark); }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--red-bright); font-weight: 700; }
.card-success .eyebrow { color: var(--ok); }
.card-title { margin: 0; font-size: 1.25rem; line-height: 1.3; overflow-wrap: anywhere; }
.percent { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--red-bright); }

.bar { height: 12px; background: #262626; border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--red-dark), var(--red) 55%, var(--red-bright));
  border-radius: 999px;
  transition: width .35s ease;
}

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

.btn-small { padding: 8px 14px; font-size: .9rem; font-weight: 600; }
.options-thumb { width: 160px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border, #333); flex: none; background: #000; }
.card-head-text { flex: 1; min-width: 0; }
@media (max-width: 520px) { #options-card .card-head { flex-wrap: wrap; } .options-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; } }
.options-heading { margin: 18px 0 10px; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 118px; padding: 10px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .1s;
}
.chip strong { font-size: 1.05rem; }
.chip span { font-size: .8rem; color: var(--muted); }
.chip:hover:not(:disabled) { border-color: var(--red); background: rgba(225, 29, 46, 0.12); }
.chip:active:not(:disabled) { transform: translateY(1px); }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.chip-locked { opacity: .45; border-style: dashed; }
.chip-locked:hover { border-color: var(--border, #333); background: inherit; }
.chip-best { border-color: var(--red); }
.chip-tag { color: var(--red-bright) !important; font-weight: 600; }
.small { font-size: .85rem; }
#progress-message { margin: 14px 0 18px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.steps li {
  padding-top: 10px; border-top: 3px solid #2e2e2e;
  font-size: .85rem; color: #777; transition: color .2s, border-color .2s;
}
.steps li.is-active { color: var(--text); border-color: var(--red); font-weight: 600; }
.steps li.is-done { color: var(--muted); border-color: var(--red-dark); }

.file-name { margin: 12px 0 4px; font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 14px; }

/* ---------- Infos ---------- */
.info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 12px; }
.info-block { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.info-block h3 { margin: 0 0 8px; font-size: .95rem; color: var(--red-bright); text-transform: uppercase; letter-spacing: .08em; }
.info-block p { margin: 0 0 8px; font-size: .95rem; }
.info-block p:last-child { margin-bottom: 0; }

.footer { position: relative; z-index: 1; padding: 22px 20px 32px; text-align: center; color: #6b6b6b; font-size: .85rem; border-top: 1px solid #181818; }
.footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .info { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
}
@media (max-width: 520px) {
  .actions { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .steps li { font-size: .75rem; }
  .percent { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
