/* Reprend les codes visuels de Vinted : teal #09B1BA, boutons pilule, fonds blancs.
   Le thème sombre inverse les neutres et garde le teal. */

/* Police du logo (SIL OFL), hébergée avec le site : aucun appel à Google Fonts. */
@font-face {
  font-family: "Pacifico";
  src: url("fonts/pacifico-latin-400.woff2") format("woff2");
  font-display: swap;
}

:root {
  --color-primary:       #09B1BA;
  --color-primary-dark:  #007782;
  --color-primary-light: #E0F7F8;

  /* Fonds */
  --bg:           #FFFFFF;
  --bg-card:      #FFFFFF;
  --bg-header:    #FFFFFF;
  --bg-soft:      #F7F7F7;
  --bg-soft-2:    #EFEFEF;
  --bg-input:     #FFFFFF;

  /* Bordures */
  --border:       #E5E5E5;
  --border-2:     #D4D4D4;
  --border-hover: var(--color-primary);

  /* Texte */
  --text:        #0F1419;
  --text-2:      #4A4A4A;
  --text-3:      #6B6B6B;
  --text-header: #0F1419;
  --text-sub:    #4A4A4A;

  --accent:        var(--color-primary);
  --accent-dark:   var(--color-primary-dark);
  --accent-light:  var(--color-primary-light);
  --accent-text:   #FFFFFF;

  /* AA : le teal de la marque (#09B1BA) ne fait que 2,6:1 sur blanc. Pour le texte on prend
     un teal plus sombre, et sur les fonds teal on écrit en foncé. */
  --link:          #007782;
  --on-accent:     #0F1419;
  --focus:         #006770;
  --input-border:  #8A8A8A;

  --success:  #0CB477;
  --error:    #D8232F;
  --warning:  #FFA621;

  --shadow:    0 1px 2px rgba(15, 20, 25, 0.04), 0 2px 8px rgba(15, 20, 25, 0.06);
  --shadow-lg: 0 4px 12px rgba(15, 20, 25, 0.08), 0 16px 32px rgba(15, 20, 25, 0.10);

  --radius-s:    4px;
  --radius:      16px;
  --radius-sm:   8px;
  --radius-pill: 999px;

  --space-xxs: 4px;
  --space-xs:  8px;
  --space-s:   12px;
  --space-m:   16px;
  --space-l:   24px;
  --space-xl:  32px;
  --space-xxl: 48px;

  --font-sans: "Vinted Sans", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.dark {
  --bg:           #0D1418;
  --bg-card:      #151D22;
  --bg-header:    #0F1419;
  --bg-soft:      #1A2329;
  --bg-soft-2:    #232D34;
  --bg-input:     #1A2329;

  --border:       #2A3640;
  --border-2:     #364551;
  --border-hover: var(--color-primary);

  --text:         #E6EDF1;
  --text-2:       #9BA8B2;
  --text-3:       #8E9AA4;
  --text-header:  #E6EDF1;
  --text-sub:     #9BA8B2;

  /* Teal un peu adouci sur fond sombre */
  --accent:        #2BC9D2;
  --accent-dark:   #09B1BA;
  --accent-light:  rgba(43, 201, 210, 0.12);

  --link:          #2BC9D2;
  --focus:         #2BC9D2;
  --input-border:  #7A8792;

  --shadow:    0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.5),  0 24px 48px rgba(0, 0, 0, 0.6);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body { color-scheme: light; }
body.dark { color-scheme: dark; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  transition: background 0.25s, color 0.25s;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* En-tête */
header {
  background: var(--bg-header);
  color: var(--text-header);
  padding: var(--space-m) var(--space-l) var(--space-l);
  border-bottom: 1px solid var(--border);
}

.header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 720px;
  margin: 0 auto var(--space-m);
}

.header-actions {
  display: flex;
  gap: var(--space-xs);
}

/* Boutons ronds du haut */
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.icon-btn:hover { background: var(--bg-soft-2); color: var(--color-primary-dark); }
.icon-btn:active { transform: scale(0.94); }
body.dark .icon-btn:hover { color: var(--link); }

/* Logo */
.hero {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: var(--space-s) var(--space-xxs) var(--space-xs);
}
#site-title { cursor: pointer; }

.hero h1 {
  font-family: "Pacifico", cursive;
  font-size: clamp(2.25rem, 9vw, 5rem);
  overflow-wrap: anywhere;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.05;
  margin-bottom: var(--space-s);
  color: var(--link);
  text-shadow: 0 1px 0 rgba(0, 119, 130, 0.08);
  user-select: none;
}
body.dark .hero h1 { color: var(--accent); }
.last-updated {
  color: var(--text-2);
  font-size: 0.75rem;
  margin: 0 0 var(--space-xs);
}

.hero-sub {
  color: var(--text-2);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-l) var(--space-m);
}

section { margin-bottom: var(--space-l); }

/* Choix une annonce / en lot */
.mode-toggle {
  display: flex;
  gap: var(--space-xxs);
  padding: var(--space-xxs);
  background: var(--bg-soft);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-m);
}
.mode-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}
.mode-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* Contexte */
.context-field { margin-top: var(--space-m); }
.context-field textarea {
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.94rem;
  font-family: inherit;
  resize: vertical;
  min-height: 64px;
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}
.context-field textarea:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Conseils */
.tips-section {
  margin-top: var(--space-m);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tips-section summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.94rem;
  user-select: none;
  transition: background 0.15s;
}
.tips-section summary::-webkit-details-marker { display: none; }
.tips-section summary:hover { background: var(--bg-soft); }
.tips-chevron {
  font-size: 0.9rem;
  color: var(--text-3);
  transition: transform 0.2s;
}
.tips-section[open] .tips-chevron { transform: rotate(180deg); }

.tips-body {
  padding: var(--space-xxs) var(--space-m) var(--space-m);
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--border);
}
.tip strong,
.tip-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: var(--space-xxs);
}
.tip p {
  font-size: 0.86rem;
  color: var(--text-2);
  line-height: 1.5;
}
.tip-mini {
  display: block;
  font-size: 0.82rem;
  color: var(--text-2);
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: var(--space-xxs);
  font-variant-numeric: tabular-nums;
}

/* Schémas de mesures */
.measure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.measure-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.18s, background 0.18s;
}
.measure-card:hover { border-color: var(--accent); }

.garment-svg {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  color: var(--text);
  display: block;
}

.measure-card-body { flex: 1; min-width: 0; }

.measure-card-body h4 {
  font-size: 0.84rem;
  font-weight: 700;
  margin: 0 0 5px;
  color: var(--text);
  line-height: 1.2;
}

.measure-card-body ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.measure-card-body li {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.4;
  padding-left: 10px;
  position: relative;
}

.measure-card-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 1px;
  background: var(--accent);
}

/* Tableau des tailles */
.size-table {
  margin-top: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.size-row {
  display: grid;
  grid-template-columns: 78px repeat(5, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}

.size-row-head {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.size-row-head > span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: center;
  padding: 4px 0;
}

.size-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.size-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  font-weight: 700;
  color: var(--text);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  min-height: 30px;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.size-pill:hover:not(.dash) {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--color-primary-dark);
}
body.dark .size-pill:hover:not(.dash) { color: var(--accent); }

.size-pill.dash {
  background: transparent;
  border-color: transparent;
  color: var(--text-3);
  font-weight: 400;
  min-height: 30px;
}

@media (max-width: 480px) {
  .measure-grid { grid-template-columns: 1fr; }
  .size-row {
    grid-template-columns: 62px repeat(5, minmax(0, 1fr));
  }
  .size-pill {
    padding: 5px 2px;
    font-size: 0.74rem;
    min-height: 28px;
  }
  .size-label { font-size: 0.7rem; }
}

/* Mode lot */
.bulk-progress {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.bulk-progress-text {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.bulk-progress-bar {
  height: 6px;
  background: var(--bg-soft-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.bulk-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 0.35s ease;
}

.bulk-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.bulk-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeIn 0.25s ease;
}
.bulk-item-head {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 8px 4px 0;
}
.bulk-item-heading { flex: 1; min-width: 0; font: inherit; }
/* Tout le haut de la carte est un bouton : il ouvre et ferme l'annonce. */
.bulk-item-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bulk-item-toggle:hover { background: var(--bg-soft); }
.bulk-item-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bulk-error { padding: 14px; color: var(--error); }
.bulk-item-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-soft);
}
.bulk-item-thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 0 4px;
}
.bulk-item-thumbs img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-soft);
}
.bulk-item-info { flex: 1; min-width: 0; }
.bulk-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bulk-item-meta {
  font-size: 0.78rem;
  color: var(--text-2);
  margin-top: 2px;
}
.bulk-item-status {
  font-size: 0.85rem;
  color: var(--text-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bulk-item-status.done { color: var(--success); }
.bulk-item-status.error { color: var(--error); }
.bulk-item-status .spinner-sm {
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.bulk-item-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--bg-soft);
  border-radius: var(--radius-s);
  padding: 1px 5px;
  margin-right: var(--space-xxs);
  flex-shrink: 0;
}

.bulk-item-delete {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  line-height: 1;
  min-width: 32px;
  min-height: 32px;
}
.bulk-item:hover .bulk-item-delete,
.bulk-item.open .bulk-item-delete,
.bulk-item-delete:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .bulk-item-delete { opacity: 1; }
}
.bulk-item-delete:hover {
  color: var(--error);
  background: rgba(216, 35, 47, 0.1);
}

.bulk-item-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
  display: none;
}
.bulk-item.open .bulk-item-body { display: block; }
.bulk-item.open .bulk-chevron { transform: rotate(180deg); }
.bulk-chevron {
  font-size: 0.85rem;
  color: var(--text-3);
  transition: transform 0.2s;
}

/* Zone de dépôt */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 20px;
  background: var(--bg-soft);
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--link);
  background: var(--accent-light);
}
.dropzone.drag { transform: scale(1.01); }

.dropzone-icon { font-size: 2.4rem; margin-bottom: 6px; }
.dropzone-title { font-weight: 600; font-size: 1.05rem; }
.dropzone-sub { color: var(--text-2); font-size: 0.88rem; }

/* Miniatures */
.previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin-top: var(--space-m);
}
.preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  animation: fadeIn 0.25s ease;
}
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 32px; height: 32px;
  border: none;
  border-radius: var(--radius-pill);
  background: rgba(15, 20, 25, 0.65);
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Estimation du coût */
.estimate {
  margin-top: var(--space-m);
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-2);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Boutons */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: var(--space-l);
  padding: 14px 24px;
  background: var(--color-primary);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.2s;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow);
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  display: block;
  width: 100%;
  margin-top: var(--space-s);
  padding: 13px 24px;
  background: transparent;
  color: var(--link);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.98rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.btn-ghost:hover {
  background: var(--accent-light);
  border-color: var(--color-primary-dark);
  color: var(--color-primary-dark);
}

.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
.chat-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.chat-header {
  display: flex;
  gap: var(--space-s);
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.chat-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.chat-name { font-weight: 600; font-size: 0.96rem; }
.chat-status { font-size: 0.82rem; color: var(--text-2); }

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 2px;
  margin-bottom: 14px;
}

.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.94rem;
  line-height: 1.45;
  animation: fadeIn 0.22s ease;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble.ai {
  background: var(--bg-soft);
  color: var(--text);
  border-top-left-radius: 4px;
  align-self: flex-start;
}
.bubble.user {
  background: var(--color-primary);
  color: var(--on-accent);
  border-top-right-radius: 4px;
  align-self: flex-end;
}
.bubble.thinking { display: flex; gap: 4px; padding: 14px 16px; }
.bubble.thinking span {
  width: 6px; height: 6px;
  background: var(--text-2);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}
.bubble.thinking span:nth-child(2) { animation-delay: 0.2s; }
.bubble.thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
  30% { opacity: 1; transform: scale(1); }
}

.chat-input {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}
.chat-input input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 0.96rem;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.chat-input input:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.chat-send {
  width: 44px; height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--on-accent);
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s, transform 0.15s;
}
.chat-send:hover { background: var(--color-primary-dark); transform: scale(1.04); }

/* Résultat */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}

.result-block {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.result-block:last-child { border-bottom: none; padding-bottom: 0; }
.result-block:first-child { padding-top: 0; }

.result-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
}

.result-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: var(--space-xs);
}

.result-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.result-description {
  font-size: 0.96rem;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--text);
}

.result-details {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 16px;
}
.result-details li {
  font-size: 0.92rem;
  display: flex;
  flex-direction: column;
}
.result-details li strong {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.price-cell {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}
.price-cell-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-xxs);
}
.price-cell-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}
body.dark .price-cell-value { color: var(--accent); }

.result-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-tips li {
  font-size: 0.92rem;
  padding-left: 18px;
  position: relative;
  color: var(--text-2);
}
.result-tips li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--link);
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--link);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.copy-btn:hover {
  background: var(--accent-light);
  border-color: var(--color-primary-dark);
  color: var(--color-primary-dark);
}
.copy-btn.done {
  background: var(--success);
  color: var(--on-accent);
  border-color: var(--success);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-m);
}

/* Fenêtres (historique, paramètres) */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 480px;
  border-radius: 22px 22px 0 0;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h2 {
  font-size: 1.2rem;
  font-weight: 700;
}
.modal-head .icon-btn {
  background: var(--bg-soft);
  color: var(--text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-weight: 600;
  font-size: 0.88rem;
}
.field input, .field select {
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.96rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.field input:focus, .field select:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.field select option {
  background: var(--bg-card);
  color: var(--text);
  padding: var(--space-xs) var(--space-s);
}
.field select option:checked,
.field select option:hover {
  background: var(--accent-light);
  color: var(--text);
}
.field-hint {
  font-size: 0.78rem;
  color: var(--text-2);
}
.field-hint a { color: var(--link); text-decoration: underline; }
.field-hint a:hover { color: var(--color-primary-dark); }

.field[hidden] { display: none; }

.key-status.ok { color: var(--color-primary-dark); font-weight: 600; }
body.dark .key-status.ok { color: var(--accent); }
.key-status.error { color: var(--error); }

.model-picker summary { cursor: pointer; list-style-position: inside; }
.model-picker select { width: 100%; margin-top: 6px; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.history-item {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-s);
}
.history-item:hover { background: var(--bg-soft); border-color: var(--link); }
.history-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--bg-soft);
}
.history-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.history-item-title { font-weight: 600; font-size: 0.92rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-date { font-size: 0.74rem; color: var(--text-3); }
.history-item-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: var(--accent-light);
  border: none;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  margin-top: 2px;
  width: fit-content;
  letter-spacing: 0.02em;
}
body.dark .history-item-badge { color: var(--accent); background: var(--accent-light); }
.history-empty {
  text-align: center;
  color: var(--text-2);
  padding: 30px 10px;
  font-size: 0.9rem;
}

/* Photos du résultat */
.result-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-xs);
  margin-bottom: var(--space-m);
}
.result-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.result-photo:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Photo en grand */
.photo-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: none;
  background: rgba(15, 20, 25, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  padding: 20px;
}
.photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Tutoriel */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: all;
}
#tutorial-overlay[hidden] { display: none; }

#tutorial-spotlight {
  position: absolute;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 9999px rgba(15, 20, 25, 0.7);
  pointer-events: none;
  z-index: 9001;
  transition: left 0.35s cubic-bezier(0.4,0,0.2,1),
              top 0.35s cubic-bezier(0.4,0,0.2,1),
              width 0.35s cubic-bezier(0.4,0,0.2,1),
              height 0.35s cubic-bezier(0.4,0,0.2,1);
}

#tutorial-tooltip {
  position: absolute;
  z-index: 9002;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  width: 270px;
  pointer-events: all;
  box-shadow: var(--shadow-lg);
  transition: left 0.35s cubic-bezier(0.4,0,0.2,1),
              top 0.35s cubic-bezier(0.4,0,0.2,1);
  color: var(--text);
}

.tutorial-tip-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s;
}
.tutorial-tip-close:hover { color: var(--text); }

.tutorial-tip-emoji {
  font-size: 1.6rem;
  margin-bottom: 6px;
  line-height: 1;
}

#tutorial-tooltip h3 {
  font-size: 0.97rem;
  font-weight: 700;
  margin-bottom: 6px;
  padding-right: 20px;
  color: var(--text);
}

#tutorial-tooltip p {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 12px;
}
#tutorial-tooltip p strong { color: var(--text); }

.tutorial-tip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.tutorial-tip-dots {
  display: flex;
  gap: 0;
  align-items: center;
}
/* Bouton de 24 px (cible tactile), point de 6 px dessiné au centre. */
.tutorial-tip-dot {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.tutorial-tip-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--input-border);
  transition: background 0.2s, transform 0.2s;
}
.tutorial-tip-dot.active::before {
  background: var(--link);
  transform: scale(1.4);
}

.tutorial-tip-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  min-width: 0;
  margin: 0 !important;
}
.btn-sm[hidden] { display: none; }

/* Interrupteurs des options */
.features-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  margin-top: var(--space-xs);
}
.feature-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: 8px 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.feature-toggle:hover { background: var(--bg-soft); }
.feature-toggle { position: relative; }
.feature-toggle input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.feature-toggle input:focus-visible ~ .feature-toggle-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.feature-toggle-track {
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--border-2);
  position: relative;
  transition: background 0.2s;
}
.feature-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.feature-toggle input:checked ~ .feature-toggle-track {
  background: var(--color-primary);
}
.feature-toggle input:checked ~ .feature-toggle-track .feature-toggle-thumb {
  transform: translateX(16px);
  background: #FFFFFF;
}
.feature-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.feature-toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.feature-toggle-hint {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.3;
}

/* Alertes règles Vinted */
.result-warnings {
  background: rgba(255, 166, 33, 0.10);
  border: 1px solid rgba(255, 166, 33, 0.4);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 4px;
  color: var(--text);
}
.result-warnings[hidden] { display: none; }
.result-warnings-head {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.01em;
}
.result-warnings ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-warnings li {
  position: relative;
  padding-left: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}
.result-warnings li::before {
  content: '•';
  position: absolute;
  left: 4px;
  color: var(--warning);
  font-weight: 700;
}
.result-warnings-foot {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-2);
  font-style: italic;
}

.bulk-item-warn {
  color: var(--warning);
  margin-right: 2px;
}
.bulk-item-status.has-warn { color: var(--warning); }

/* Lien source */
.source-link {
  font-size: 0.85rem;
  color: var(--link);
  text-decoration: none;
  word-break: break-all;
  font-weight: 500;
}
.source-link:hover { color: var(--color-primary-dark); text-decoration: underline; }

/* Toast */
.toast:empty { display: none; }
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg-card);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s cubic-bezier(.2,.8,.2,1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Accessibilité */
*:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

::placeholder { color: var(--text-2); opacity: 1; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Couleurs forcées (contraste élevé de Windows) : les états ne peuvent plus passer par la couleur. */
@media (forced-colors: active) {
  .feature-toggle-track { border: 1px solid CanvasText; }
  .feature-toggle input:checked ~ .feature-toggle-track .feature-toggle-thumb { background: Highlight; }
  .mode-btn[aria-pressed="true"] { outline: 2px solid Highlight; }
  .btn-primary, .btn-ghost, .copy-btn { border: 1px solid ButtonText; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 480px) {
  header { padding: 14px 16px 24px; }
  .hero h1 { font-size: 2.75rem; }
  main { padding: 20px 14px; }
  .dropzone { padding: 32px 16px; }
  .price-grid { grid-template-columns: 1fr; }
  .price-cell { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; text-align: left; }
  .price-cell-label { margin-bottom: 0; }
  .modal-card { max-height: 90vh; }
}

@media (min-width: 700px) {
  .modal { align-items: center; }
  .modal-card { border-radius: var(--radius); max-height: 80vh; }
  .result-actions { flex-direction: row; }
  .result-actions button { margin-top: 0; }
}

/* Grand écran : historique | app | paramètres */
@media (min-width: 1180px) {
  .app-shell {
    display: grid;
    grid-template-columns: minmax(260px, 300px) minmax(0, 720px) minmax(280px, 340px);
    gap: var(--space-l);
    max-width: 1420px;
    margin: 0 auto;
    padding: var(--space-l) 20px 8px;
    align-items: start;
  }
  .app-shell main {
    padding: 0;
    margin: 0;
    max-width: 100%;
    grid-column: 2;
    grid-row: 1;
  }
  .app-shell #history-modal  { grid-column: 1; grid-row: 1; }
  .app-shell #settings-modal { grid-column: 3; grid-row: 1; }

  .app-shell .modal {
    position: sticky;
    top: var(--space-l);
    inset: auto;
    background: transparent;
    backdrop-filter: none;
    display: block;
    padding: 0;
    z-index: 1;
    animation: none;
    align-items: stretch;
    justify-content: stretch;
  }
  .app-shell .modal[hidden] { display: block; }
  .app-shell .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius);
    height: calc((100vh - 48px) / 2);
    padding: 20px;
    gap: 14px;
    animation: none;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
  }
  .app-shell .modal-head .icon-btn { display: none; }
  .app-shell .modal-head h2 { font-size: 1.05rem; }

  .app-shell #history-modal .modal-card { overflow: hidden; }
  .app-shell #history-modal .history-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
  }

  #history-toggle, #settings-toggle { display: none; }
}

/* Ajouts accessibilité et traduction */
.section-heading {
  margin-bottom: var(--space-s);
  font-size: 1.1rem;
  font-weight: 700;
}
.section-heading:focus { outline: none; }
.section-heading:focus-visible { outline: 3px solid var(--focus); }
.chat-name:focus { outline: none; }

.tour-btn {
  margin-top: var(--space-s);
  min-height: 44px;
  padding: 8px 18px;
  background: transparent;
  color: var(--link);
  border: 1px solid var(--link);
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tour-btn:hover { background: var(--accent-light); }

.btn-add {
  min-height: 44px;
  padding: 10px 22px;
  background: var(--color-primary);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-add:hover { background: var(--accent); }
.dropzone { cursor: default; }

.privacy-note {
  margin-top: var(--space-m);
  font-size: 0.82rem;
  color: var(--text-2);
  text-align: center;
}

.noscript {
  max-width: 560px;
  margin: var(--space-m) auto 0;
  padding: var(--space-m);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.no-js .upload-section { display: none; }

fieldset.field { border: none; padding: 0; margin: 0; min-width: 0; }
.privacy { margin-top: var(--space-m); padding-top: var(--space-m); border-top: 1px solid var(--border); }

/* Libellés devenus des titres : même apparence. */
h3.result-label, h4.result-label { font-family: inherit; }
.result-warnings-head { font-size: inherit; }

/* Prix en liste de définitions : on retire les marges par défaut. */
.price-grid dt, .price-grid dd { margin: 0; }

.result-photo-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: var(--radius-sm);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 44px;
  padding: 8px 16px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.key-note, .brand-note {
  max-width: 480px;
  margin: var(--space-xs) auto 0;
  font-size: 0.82rem;
  color: var(--text-2);
}

/* Téléphone en paysage : l'en-tête ne doit pas prendre tout l'écran. */
@media (max-height: 500px) and (orientation: landscape) {
  header { padding-top: 12px; padding-bottom: 12px; }
  .hero h1 { font-size: clamp(2rem, 10vh, 3rem); margin-bottom: 4px; }
}

.remember {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 44px;
  font-size: 0.9rem;
  cursor: pointer;
}
.remember input { width: 20px; height: 20px; accent-color: var(--link); }
