:root {
  --fond: #f3f4f6; --surface: #ffffff; --surface-2: #f6f7f9; --trait: #d9dde3;
  --texte: #1a1d23; --gris: #5d6470; --accent: #c5221f; --accent-texte: #ffffff; --accent-doux: rgba(197, 34, 31, .08);
  --erreur: #b3261e; --ok: #1e7a45;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #111317; --surface: #1a1d23; --surface-2: #22262d; --trait: #343943;
    --texte: #e8eaed; --gris: #9aa1ac; --accent: #ff6b63; --accent-texte: #1c0605; --accent-doux: rgba(255, 107, 99, .12);
    --erreur: #ff8a80; --ok: #6fd39a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #111317; --surface: #1a1d23; --surface-2: #22262d; --trait: #343943;
  --texte: #e8eaed; --gris: #9aa1ac; --accent: #ff6b63; --accent-texte: #1c0605; --accent-doux: rgba(255, 107, 99, .12);
  --erreur: #ff8a80; --ok: #6fd39a;
  color-scheme: dark;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; background: var(--fond); color: var(--texte); font-size: 16px; line-height: 1.5; }
[hidden] { display: none !important; }
h1 { font-size: 1.7rem; margin: 0; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 4px; line-height: 1.3; }
p { margin: .35rem 0; }
.discret { color: var(--gris); }
.petit { font-size: .88rem; }
.erreur { color: var(--erreur); }
.erreur:empty, .etat:empty { display: none; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.page { max-width: 720px; margin: 0 auto; padding: 22px 16px 44px; }
.page.etroite { max-width: 360px; padding-top: 16vh; text-align: center; }
.page.etroite form { text-align: left; margin-top: 18px; }

/* Titre au milieu, déconnexion à droite */
.entete { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.entete > :last-child { justify-self: end; }
.titre-site { display: inline-flex; align-items: center; gap: 10px; justify-content: center; letter-spacing: -.01em; }
.pastille { width: 34px; height: 24px; border-radius: 7px; background: var(--accent); position: relative; flex: none; }
.pastille::after { content: ""; position: absolute; left: 13px; top: 6px; border-left: 10px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.sous-titre { text-align: center; max-width: 36em; margin: 8px auto 18px; }
@media (max-width: 520px) {
  .entete { grid-template-columns: 1fr; }
  .entete > :first-child { display: none; }
  .entete > :last-child { justify-self: center; }
}

/* Cartes, champs, boutons */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: 16px; padding: 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.ligne { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.ligne input { flex: 1 1 14em; }
input[type=url], input[type=text], input[type=password], select { font: inherit; color: var(--texte); background: var(--surface-2); border: 1px solid var(--trait); border-radius: 10px; padding: 11px 13px; min-height: 48px; width: 100%; }
.champ { display: flex; flex-direction: column; gap: 4px; flex: 1 1 8em; font-size: .9rem; color: var(--gris); }
.bouton { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--trait); background: var(--surface); color: var(--texte); cursor: pointer; text-decoration: none; }
.bouton:hover { border-color: var(--gris); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.bouton.large { width: 100%; min-height: 50px; font-size: 1.05rem; }
.bouton.danger { color: var(--erreur); }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.lien { font: inherit; background: none; border: 0; padding: 4px 2px; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Aperçu d'une vidéo */
.fiche { display: flex; gap: 14px; align-items: flex-start; }
.miniature { width: 200px; max-width: 42%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--surface-2); flex: none; }
.fiche-texte { min-width: 0; }
.fiche-texte h2 { overflow-wrap: anywhere; }
@media (max-width: 520px) { .fiche { flex-direction: column; } .miniature { width: 100%; max-width: none; } }
.onglets { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--trait); border-radius: 12px; padding: 4px; gap: 4px; }
.onglet { position: relative; cursor: pointer; }
.onglet input { position: absolute; opacity: 0; inset: 0; }
.onglet span { display: block; text-align: center; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--gris); }
.onglet input:checked + span { background: var(--surface); color: var(--texte); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.onglet input:disabled + span { opacity: .4; }
.onglet input:focus-visible + span { outline: 3px solid var(--accent); }
.choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.puce { position: relative; cursor: pointer; }
.puce input { position: absolute; opacity: 0; inset: 0; }
.puce span { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 11px; background: var(--surface-2); height: 100%; }
.puce small { color: var(--gris); font-size: .8rem; }
.puce input:checked + span { border-color: var(--accent); background: var(--accent-doux); box-shadow: inset 0 0 0 1px var(--accent); }
.puce input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.note { font-size: .88rem; margin: -4px 0 0; }
.extrait summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
.extrait .ligne { margin-top: 8px; }

/* Playlist */
.ll-actions { gap: 14px; }
.entrees { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; border: 1px solid var(--trait); border-radius: 12px; }
.entrees li + li { border-top: 1px solid var(--trait); }
.entrees label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; }
.entrees input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.entrees img { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; flex: none; }
.entree-texte { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }

/* Historique */
.titre-liste { text-align: center; margin: 26px 0 12px; }
#vide { text-align: center; }
.liste { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.liste li { background: var(--surface); border: 1px solid var(--trait); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.tete { display: flex; gap: 12px; align-items: center; }
.vignette { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.tete-texte { min-width: 0; }
.titre { font-weight: 700; overflow-wrap: anywhere; margin: 0; }
.infos { margin: 2px 0 0; font-size: .92rem; }
.progres { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.barre-progres { height: 6px; background: var(--surface-2); border: 1px solid var(--trait); border-radius: 3px; overflow: hidden; }
.barre-progres div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.envoye { color: var(--ok); margin: 0; font-size: .92rem; }
.message { margin: 0; }

.pied { margin-top: 30px; text-align: center; font-size: .9rem; }
.pied .petit { max-width: 38em; margin: 6px auto; }
.annonce { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--texte); color: var(--fond); padding: 10px 16px; border-radius: 10px; font-size: .95rem; max-width: calc(100vw - 36px); z-index: 20; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
