/* Koyeba Prompt : charte « Le Point » (orange #FE7F04, noir #0B0B0B, blanc #FFFFFF) */
:root {
  --orange: #fe7f04;
  --orange-doux: rgba(254, 127, 4, 0.14);
  --noir: #0b0b0b;
  --blanc: #ffffff;
  --fond: #0b0b0b;
  --surface: #141414;
  --surface-2: #1b1b1b;
  --bordure: #272727;
  --bordure-forte: #3a3a3a;
  --texte: #f5f5f5;
  --texte-doux: #a3a3a3;
  --texte-pale: #6b6b6b;
  --rouge: #ff6b6b;
  --rayon: 18px;
  --police: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--fond);
  background-image: radial-gradient(1200px 500px at 50% -180px, rgba(254, 127, 4, 0.13), transparent 70%);
  background-repeat: no-repeat;
  color: var(--texte);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.point { color: var(--orange); }

/* ---------- barre du haut ---------- */
.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
}
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texte); }
.marque img { height: 30px; width: auto; display: block; }
.produit {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--noir);
  background: var(--orange);
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 4px;
}
.barre-droite { display: flex; align-items: center; gap: 10px; }
.statut {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--texte-doux);
  border: 1px solid var(--bordure);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.statut i { width: 8px; height: 8px; border-radius: 50%; background: var(--texte-pale); }
.statut.ia i { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-doux); }
.bouton-fantome {
  background: transparent;
  border: 1px solid var(--bordure);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--texte-doux);
  transition: border-color 0.15s, color 0.15s;
}
.bouton-fantome:hover { border-color: var(--bordure-forte); color: var(--texte); }

main {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px 80px;
  flex: 1;
}

/* ---------- accueil ---------- */
.accueil { text-align: center; padding: clamp(28px, 7vw, 72px) 0 clamp(24px, 4vw, 40px); }
.surtitre {
  margin: 0 0 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
}
h1 {
  margin: 0;
  font-size: clamp(2.3rem, 7vw, 4.6rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.035em;
}
h1 > span { display: inline-block; }
.sous-titre {
  max-width: 620px;
  margin: 20px auto 0;
  color: var(--texte-doux);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}

/* ---------- atelier (formulaire) ---------- */
.atelier {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 24px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  transition: border-color 0.2s;
}
.atelier:focus-within { border-color: var(--bordure-forte); }
#idee {
  width: 100%;
  resize: none;
  border: 0;
  background: transparent;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  padding: 4px 2px;
  min-height: 1.4em;
  overflow: hidden;
}
#idee::placeholder { color: var(--texte-pale); }
#idee:focus { outline: none; }

.exemples { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.exemples button {
  background: var(--surface-2);
  border: 1px solid var(--bordure);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.85rem;
  color: var(--texte-doux);
  transition: all 0.15s;
}
.exemples button:hover { color: var(--texte); border-color: var(--orange); }

.reglages {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--bordure);
}
.reglage { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; margin: 0; padding: 0; }
.reglage > span, .reglage legend {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--texte-pale);
  padding: 0;
  margin-bottom: 6px;
}
.reglage > span { margin-bottom: 0; }
select {
  appearance: none;
  width: 100%;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23a3a3a3' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 11px 38px 11px 14px;
  font-size: 0.95rem;
}
select:hover { border-color: var(--bordure-forte); }
.segments {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 3px;
}
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments label {
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.9rem;
  color: var(--texte-doux);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.segments input:checked + label { background: var(--orange); color: var(--noir); font-weight: 600; }
.segments input:focus-visible + label { outline: 2px solid var(--orange); outline-offset: 2px; }

.lancer { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 20px; }
.raccourci { font-size: 0.8rem; color: var(--texte-pale); }
.bouton-principal {
  background: var(--orange);
  color: var(--noir);
  border: 0;
  border-radius: 14px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 10px 30px -10px rgba(254, 127, 4, 0.7);
}
.bouton-principal:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgba(254, 127, 4, 0.85); }
.bouton-principal:active { transform: translateY(0); }
.bouton-principal span { transition: transform 0.15s; }
.bouton-principal:hover span { transform: translateX(3px); }
.bouton-principal.en-cours { opacity: 0.85; }

/* ---------- résultat ---------- */
.resultat { margin-top: 44px; scroll-margin-top: 20px; }

.etapes {
  list-style: none;
  margin: 0 0 36px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.etapes li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--texte-pale);
  text-align: center;
  transition: color 0.3s;
}
.etapes li::before {
  content: "";
  position: absolute;
  top: 7px;
  left: calc(-50% + 12px);
  right: calc(50% + 12px);
  height: 2px;
  background: var(--bordure);
  transition: background 0.4s;
}
.etapes li:first-child::before { display: none; }
.etapes i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--bordure-forte);
  background: var(--fond);
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}
.etapes li.actif { color: var(--texte); }
.etapes li.actif i { border-color: var(--orange); background: var(--orange); animation: pulsation 1.3s ease-in-out infinite; }
.etapes li.fait { color: var(--texte-doux); }
.etapes li.fait i { border-color: var(--orange); background: var(--orange); }
.etapes li.fait::before, .etapes li.actif::before { background: var(--orange); }
.etapes li[data-etape="pret"].fait { color: var(--orange); font-weight: 600; }
@keyframes pulsation {
  0%, 100% { box-shadow: 0 0 0 0 rgba(254, 127, 4, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(254, 127, 4, 0); }
}

.bloc + .bloc { margin-top: 44px; }
.entete-bloc { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.numero {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--orange-doux);
  color: var(--orange);
  font-size: 0.85rem;
  font-weight: 700;
}
.compteur { font-size: 0.85rem; color: var(--texte-pale); font-variant-numeric: tabular-nums; }

/* la carte de fabrication */
.carte {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.carte:empty::before {
  content: "";
  grid-column: 1 / -1;
  height: 120px;
  border-radius: var(--rayon);
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: chargement 1.4s linear infinite;
}
@keyframes chargement { to { background-position: -200% 0; } }
.fiche {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 18px 20px 16px;
  animation: apparition 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.fiche.large { grid-column: 1 / -1; border-left: 3px solid var(--orange); }
@keyframes apparition {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.fiche h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fiche h3 .emoji {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 1.05rem;
  flex-shrink: 0;
}
.fiche ul { margin: 0; padding: 0; list-style: none; }
.fiche li {
  position: relative;
  padding-left: 16px;
  font-size: 0.92rem;
  color: #d4d4d4;
  line-height: 1.5;
}
.fiche li + li { margin-top: 6px; }
.fiche li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}
.fiche p { margin: 0 0 6px; font-size: 0.92rem; color: #d4d4d4; }
.fiche strong { color: var(--texte); font-weight: 600; }
.fiche code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.fiche.large ul { columns: 3 260px; column-gap: 28px; }
.fiche.large li { break-inside: avoid; }
.pastille {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: var(--c);
  border: 1px solid rgba(255, 255, 255, 0.25);
  vertical-align: -1px;
  margin-right: 5px;
}

/* curseur qui écrit */
.ecrit::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--orange);
  animation: clignote 0.9s steps(1) infinite;
}
@keyframes clignote { 50% { opacity: 0; } }

/* le prompt */
.cadre-prompt {
  background: #0f0f0f;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  overflow: hidden;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--bordure);
  background: var(--surface);
  position: sticky;
  top: 0;
}
.bouton-action {
  background: var(--surface-2);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s;
}
.bouton-action:hover:not(:disabled) { border-color: var(--bordure-forte); }
.bouton-action.principal { background: var(--orange); border-color: var(--orange); color: var(--noir); font-weight: 700; }
.bouton-action.principal:hover:not(:disabled) { filter: brightness(1.08); }
.bouton-action:disabled { opacity: 0.4; cursor: not-allowed; }
.bouton-action.ok { background: #1f3d24; border-color: #2f6b38; color: #b9f3c2; }
.prompt {
  margin: 0;
  padding: clamp(18px, 3vw, 28px);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.7;
  color: #e5e5e5;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 140px;
  tab-size: 2;
}

.erreur {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.08);
  color: var(--rouge);
}

/* ---------- historique ---------- */
.voile { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 10; }
.historique {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--bordure);
  z-index: 11;
  display: flex;
  flex-direction: column;
  padding: 20px;
  animation: glisse 0.25s ease-out;
}
@keyframes glisse { from { transform: translateX(30px); opacity: 0; } }
.entete-historique { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
#liste-historique { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#liste-historique li + li { margin-top: 8px; }
#liste-historique button {
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.15s;
}
#liste-historique button:hover { border-color: var(--orange); }
#liste-historique strong { display: block; font-weight: 600; font-size: 0.95rem; }
#liste-historique small { color: var(--texte-pale); font-size: 0.78rem; }
#liste-historique .vide { color: var(--texte-pale); font-size: 0.9rem; padding: 12px 0; }
.effacer { margin-top: 14px; align-self: flex-start; }

/* ---------- pied ---------- */
.pied {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 28px 16px 36px;
  color: var(--texte-pale);
  font-size: 0.85rem;
  border-top: 1px solid #161616;
}
.pied img { opacity: 0.7; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .reglages { grid-template-columns: 1fr; }
  .segments label { flex: 1; text-align: center; }
  .raccourci { display: none; }
  .bouton-principal { width: 100%; justify-content: center; }
  .etapes li span { font-size: 0.72rem; }
  .statut span { display: none; }
  .statut { padding: 7px; }
  .carte { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
