/* RingtoneForge — feuille unique, mobile d'abord. */

:root {
  --bg: #0d0f16;
  --card: #161923;
  --card-2: #1e222e;
  --line: #2a2f3d;
  --text: #e9ecf4;
  --muted: #949cb0;
  --accent: #f5b544;
  --accent-dark: #d99722;
  --ok: #4ec97f;
  --err: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 16px 64px;
  /* Couleur unie d'abord : le degrade seul laisserait un fond blanc sur les
     zones de rebond et si l'image de fond n'est pas rendue. */
  background-color: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% -10%, #1b2030 0%, var(--bg) 60%);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

code {
  background: var(--card-2);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.9em;
}

/* --- en-tete --- */
.top {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 0 24px;
  text-align: center;
}
.top h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 40px);
  letter-spacing: -0.02em;
}
.logo { filter: drop-shadow(0 0 12px rgba(245, 181, 68, 0.5)); }
.tagline { margin: 8px 0 14px; color: var(--muted); }
.privacy {
  display: inline-block;
  margin: 0;
  padding: 7px 14px;
  border: 1px solid rgba(78, 201, 127, 0.35);
  background: rgba(78, 201, 127, 0.08);
  color: var(--ok);
  border-radius: 999px;
  font-size: 13px;
}

main { max-width: 760px; margin: 0 auto; }

/* --- cartes --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 19px;
}
.num {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 50%;
  background: var(--accent);
  color: #16181f;
  font-size: 15px;
  font-weight: 700;
}

/* --- onglets --- */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--card-2);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.tab {
  flex: 1;
  padding: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.tab.is-active { background: var(--card); color: var(--text); font-weight: 600; }

/* --- depot de fichier --- */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 34px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over {
  border-color: var(--accent);
  background: rgba(245, 181, 68, 0.05);
  outline: none;
}
.dz-icon { font-size: 34px; }
.dz-main { margin: 8px 0 2px; font-size: 17px; font-weight: 600; }
.dz-sub { margin: 0; color: var(--muted); font-size: 14px; }
.dz-formats { margin: 12px 0 0; color: #6c7488; font-size: 12.5px; }
.link { color: var(--accent); text-decoration: underline; }

/* --- champs --- */
.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  color: var(--muted);
}
input[type=url], input[type=text], select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* sous 16px, iOS zoome au focus */
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.advanced { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* --- boutons --- */
.btn {
  display: inline-block;
  padding: 12px 20px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px; /* cible tactile confortable */
}
.btn-primary { width: 100%; background: var(--accent); color: #16181f; font-size: 17px; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-play { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn-play.is-playing { background: var(--accent); color: #16181f; border-color: var(--accent); }

/* --- forme d'onde --- */
.filename {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.wave-wrap {
  background: #10121a;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
#wave { display: block; width: 100%; height: 150px; }

/* --- minuteurs --- */
.times {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 14px;
}
.time-box { text-align: center; flex: 1 1 auto; }
.time-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.nudge { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.nudge output {
  min-width: 74px;
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 600;
}
.btn-nudge {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn-nudge:hover { border-color: var(--accent); }
.duration {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.duration.is-max { color: var(--err); }

.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

/* --- lecture et reglages --- */
.playbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.qual select { width: auto; padding: 6px 8px; font-size: 14px; }

.controls { display: grid; gap: 14px; }
.slider > span {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 5px;
}
.slider output { color: var(--text); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 26px; }
.switches { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

/* --- avancement et resultat --- */
.status { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
.status.is-error {
  color: var(--err);
  background: rgba(255, 107, 107, .08);
  border: 1px solid rgba(255, 107, 107, .3);
  padding: 10px 12px;
  border-radius: 9px;
  line-height: 1.5;
}
.bar {
  height: 7px;
  background: var(--card-2);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .2s;
}

#result {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(78, 201, 127, .35);
  background: rgba(78, 201, 127, .07);
  border-radius: 11px;
  text-align: center;
}
#result h3 { margin: 0 0 4px; font-size: 17px; color: var(--ok); }
#result .meta { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.download {
  display: inline-block;
  padding: 13px 26px;
  background: var(--ok);
  color: #0d1a12;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
}
#result audio { width: 100%; margin-top: 14px; }

/* --- mode d'emploi --- */
.guide h2 { font-size: 18px; }
.steps { margin: 12px 0 0; padding-left: 22px; }
.steps li { margin-bottom: 9px; font-size: 14.5px; color: #c6ccda; }
.steps strong { color: var(--text); }

footer {
  max-width: 760px;
  margin: 28px auto 0;
  text-align: center;
  color: #6c7488;
  font-size: 13px;
}
.small { font-size: 12px; }

@media (max-width: 560px) {
  .card { padding: 17px; }
  .times { gap: 8px; }
  .time-box { flex-basis: 100%; }
  .nudge { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
