/* Timothee Kids - PWA mobile first.
   Charte issue des illustrations kids2yt/fonds:
   bleus profonds, ambre chaud, creme, lumiere douce. */

:root {
  color-scheme: light;

  /* Encres */
  --ink: #16243d;
  --ink-soft: #46586f;
  --ink-faint: #6b7d95;

  /* Bleus de la charte */
  --blue-900: #12294d;
  --blue-800: #1b3a6b;
  --blue-700: #24518f;
  --blue-500: #3f7ac2;
  --blue-100: #dfeaf9;

  /* Ambre / bois chaud */
  --amber-600: #c97c1f;
  --amber-500: #e5a536;
  --amber-200: #f7dcae;

  /* Terres des histoires */
  --rust-700: #9d3d1c;
  --rust-500: #c4532a;

  /* Papier */
  --cream: #fdf7ec;
  --paper: #ffffff;
  --paper-soft: #f6f1e6;
  --line: rgba(22, 36, 61, 0.10);

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-card: 0 14px 30px rgba(18, 41, 77, 0.18);
  --shadow-soft: 0 6px 18px rgba(18, 41, 77, 0.10);

  --font-display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-text: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --bar-height: 112px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* L'attribut hidden doit l'emporter sur tout display defini plus bas. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-text);
  color: var(--ink);
  background: var(--blue-900);
  overscroll-behavior-y: contain;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

/* ---------- Coquille ---------- */

.app {
  position: relative;
  min-height: 100%;
  min-height: 100dvh;
}

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.is-active {
  display: block;
}

/* ---------- Accueil ---------- */

.screen--home {
  position: relative;
  overflow: hidden;
}

.home__bg {
  position: fixed;
  inset: 0;
  background-image: url("/assets/img/home-bg.webp");
  background-size: cover;
  background-position: center;
  transform: scale(1.04);
}

.home__scrim {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 247, 232, 0.55), transparent 60%),
    linear-gradient(180deg, rgba(253, 247, 236, 0.32) 0%, rgba(18, 41, 77, 0.34) 62%, rgba(18, 41, 77, 0.58) 100%);
}

.home__content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100dvh;
  padding: calc(var(--safe-top) + 14px) 22px calc(var(--safe-bottom) + 10px);
}

.home__header {
  flex: 0 0 auto;
  text-align: center;
  padding: 4px 0 2px;
}

.wordmark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  width: 100%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 7.4vw, 38px);
  line-height: 1;
  max-width: 100%;
}

.wordmark__timothee {
  color: var(--blue-800);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.9), 0 10px 22px rgba(18, 41, 77, 0.22);
}

.wordmark__kids {
  width: auto;
  height: 1.18em;
  max-width: 42%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(18, 41, 77, 0.28));
}

.home__doors {
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: 1fr 1fr auto;
  gap: 14px;
  padding: 2px 0;
  min-height: 0;
}

.door {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--cream);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.door:active {
  transform: scale(0.982);
  box-shadow: 0 8px 18px rgba(18, 41, 77, 0.2);
}

.door__art {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 8px 8px 0;
  border-radius: 20px;
  overflow: hidden;
  background-size: cover;
  background-position: center 42%;
}

/* Carrousel en fondu: deux calques superposes, un seul visible a la fois.
   Tant qu'aucune image admin n'existe pour cette porte, aucun calque n'est
   injecte et le background-image statique ci-dessous reste seul visible. */
.door__art-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 42%;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.door__art-layer.is-visible {
  opacity: 1;
}

.door--paroles .door__art {
  background-image: url("/assets/img/door-paroles.webp");
}

.door--histoires .door__art {
  background-image: url("/assets/img/door-histoires.webp");
}

.door__plate {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 16px 14px;
}

.door__label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(21px, 6.2vw, 27px);
  line-height: 1.1;
  text-align: center;
}

.door--paroles .door__label {
  color: var(--blue-800);
}

.door--histoires .door__label {
  color: var(--rust-700);
}

.door__count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
}

.door__count:empty {
  display: none;
}

.door--chants {
  flex-direction: row;
  align-items: center;
  min-height: 64px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--paper);
  text-decoration: none;
}

.door--chants:active {
  transform: scale(0.982);
}

.door__chants-icon {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  margin: 8px 0 8px 8px;
  border-radius: 14px;
  object-fit: cover;
}

.door__label--chants {
  flex: 1 1 auto;
  color: var(--ink);
  font-size: clamp(15px, 4vw, 18px);
  text-align: center;
}

.home__footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
}

.home__admin-link {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--ink-faint);
  text-decoration: none;
  opacity: 0.28;
  transition: opacity 0.15s ease;
}

.home__admin-link svg {
  width: 15px;
  height: 15px;
}

@media (hover: hover) {
  .home__admin-link:hover {
    opacity: 0.7;
  }
}

.home__legal {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
}

.home__legal a {
  color: var(--ink-faint);
  font-size: 10px;
  text-decoration: none;
}

.home__legal span {
  color: var(--ink-faint);
  font-size: 10px;
}

@media (hover: hover) {
  .home__legal a:hover {
    text-decoration: underline;
  }
}

/* ---------- Accueil en paysage ---------- */

/*
 * Des que l'ecran est plus large que haut, deux bandeaux empiles deviennent
 * tres larges et tres plats: l'illustration est zoomee a l'extreme et on ne
 * voit plus que des visages coupes. On passe alors les deux portes cote a
 * cote, en limitant leur largeur pour leur garder une forme de carte.
 */
@media (min-aspect-ratio: 1 / 1) and (min-width: 700px) {
  .home__content {
    gap: clamp(12px, 2.2vh, 26px);
    padding: clamp(14px, 3vh, 30px) max(24px, 4vw) clamp(12px, 2.4vh, 24px);
  }

  .home__doors {
    grid-template-rows: 1fr auto;
    grid-template-columns: 1fr 1fr;
    gap: clamp(14px, 2.4vw, 28px);
    /* Le fond salon doit rester visible autour des cartes. */
    width: min(100%, 1040px);
    justify-content: center;
    margin-inline: auto;
    align-items: stretch;
  }

  .door {
    /* Portrait doux: proche de la maquette, sans ecraser l'illustration.
       Le plafond evite des cartes demesurees sur un grand ecran. */
    aspect-ratio: 4 / 3.4;
    max-height: min(100%, 460px);
    margin-block: auto;
  }

  .door--chants {
    grid-column: 1 / -1;
    aspect-ratio: auto;
    max-height: none;
    margin-block: 0;
  }

  .door__art {
    background-position: center 38%;
  }

  .door__label {
    font-size: clamp(20px, 1.9vw, 26px);
  }

  /* Le fond portrait, etire en 16/9, perd toute lecture: on sert une image
     paysage prise dans le meme univers. */
  .home__bg {
    background-image: url("/assets/img/home-bg-wide.webp");
    background-size: cover;
    transform: scale(1.06);
  }

  .home__scrim {
    background:
      radial-gradient(90% 60% at 50% 0%, rgba(255, 247, 232, 0.5), transparent 62%),
      linear-gradient(180deg, rgba(253, 247, 236, 0.28) 0%, rgba(18, 41, 77, 0.3) 58%, rgba(18, 41, 77, 0.52) 100%);
  }
}

/* Ecran large mais tres peu haut: on rend la hauteur aux illustrations. */
/* Ecran large mais peu haut: le ratio fixe ne tient plus, la carte doit
   simplement remplir la hauteur disponible. */
@media (min-aspect-ratio: 1 / 1) and (max-height: 700px) {
  .home__header {
    padding: 0;
  }

  .wordmark {
    font-size: clamp(22px, 3.4vw, 30px);
  }

  .door {
    aspect-ratio: auto;
    height: 100%;
    margin-block: 0;
  }

  .door--chants {
    height: auto;
  }

  .door__plate {
    padding: 8px 12px 10px;
  }
}

/* ---------- Catalogue ---------- */

.screen--browse {
  background: var(--cream);
  padding-bottom: calc(var(--safe-bottom) + 28px);
}

.browse__bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + 10px) 14px 8px;
  background: rgba(253, 247, 236, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.browse__bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  margin-inline: auto;
}

.icon-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(27, 58, 107, 0.08);
  color: var(--blue-800);
  cursor: pointer;
}

.icon-button:active {
  background: rgba(27, 58, 107, 0.16);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.icon-button--ondark {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Barre de recherche fine */
.search {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.search__icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
}

.search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  border: 0;
  background: transparent;
  font-size: 16px; /* evite le zoom iOS */
  outline: none;
}

.search__input::placeholder {
  color: var(--ink-faint);
}

.search__input::-webkit-search-cancel-button {
  display: none;
}

.search__clear {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(22, 36, 61, 0.08);
  color: var(--ink-soft);
  cursor: pointer;
}

.search__clear svg {
  width: 14px;
  height: 14px;
}

.browse__title {
  max-width: 640px;
  margin: 8px auto 6px;
  padding: 0 2px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--blue-800);
  transition: margin 180ms ease, font-size 180ms ease, opacity 160ms ease;
}

/* Au defilement, on rend l'espace vertical aux tuiles: seule la recherche
   et les filtres restent accessibles. */
.browse__bar.is-compact .browse__title {
  margin: 0 auto;
  font-size: 0;
  opacity: 0;
}

.screen--browse[data-kind="histoire_racontee"] .browse__title {
  color: var(--rust-700);
}

/* Chips de themes, defilement horizontal */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 14px 8px;
  margin: 0 -14px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.chip.is-active {
  background: var(--blue-800);
  border-color: var(--blue-800);
  color: #fff;
}

.chip--kind {
  background: #fff8ea;
  border-color: #ead9b7;
  color: #7a5510;
}

.chip--kind.is-active {
  background: var(--amber-600);
  border-color: var(--amber-600);
  color: #fff;
}

.screen--browse[data-kind="histoire_racontee"] .chip.is-active {
  background: var(--rust-700);
  border-color: var(--rust-700);
}

.browse__body {
  padding: 12px 14px 0;
}

.result-count {
  margin: 2px 2px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
}

/* Grille de tuiles facon Shorts */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.story-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.story-preview__poster {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(160deg, var(--rust-500), #6d2a13);
  box-shadow: var(--shadow-soft);
}

.story-preview__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-preview__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  color: rgba(255, 255, 255, 0.94);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.12;
}

.story-preview__poster.has-image .story-preview__fallback {
  opacity: 0;
}

.story-preview__caption {
  padding: 8px 4px 0;
}

.story-preview__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
}

.story-preview__meta {
  margin: 3px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
}

@media (min-width: 560px) {
  .tiles {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 860px) {
  .tiles {
    grid-template-columns: repeat(4, 1fr);
  }

  .browse__body,
  .browse__bar {
    max-width: 1100px;
    margin-inline: auto;
  }
}

.tile {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease;
  /* Le navigateur saute la mise en page des tuiles hors ecran.
     La taille estimee ne porte que sur la hauteur: en contraindre la
     largeur ecraserait le 1fr de la grille. */
  content-visibility: auto;
  contain-intrinsic-height: auto 300px;
}

.tile:active {
  transform: scale(0.97);
}

.tile__poster {
  position: relative;
  aspect-ratio: 3 / 4.4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(160deg, var(--blue-700), var(--blue-900));
  box-shadow: var(--shadow-soft);
}

.tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 260ms ease;
}

/* Une miniature 16:9 recadree en 9:16 perd l'essentiel de l'image.
   On la pose entiere sur un fond flou tire de la meme image. */
.tile__poster--wide .tile__img {
  object-fit: contain;
}

.tile__blur {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  filter: blur(18px) saturate(1.15);
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 260ms ease;
}

.tile__blur.is-loaded {
  opacity: 0.85;
}

.tile__img.is-loaded {
  opacity: 1;
}

/* Habillage de secours quand il n'y a pas encore de vignette */
.tile__poster.has-image .tile__fallback {
  opacity: 0;
}

.tile__fallback {
  position: absolute;
  inset: 0;
  transition: opacity 200ms ease;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  background:
    radial-gradient(90% 60% at 50% 12%, rgba(255, 255, 255, 0.22), transparent 70%),
    linear-gradient(165deg, var(--blue-700) 0%, var(--blue-900) 100%);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
}

.tile--histoire .tile__fallback {
  background:
    radial-gradient(90% 60% at 50% 12%, rgba(255, 255, 255, 0.2), transparent 70%),
    linear-gradient(165deg, var(--rust-500) 0%, #6d2a13 100%);
}

.tile__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 41, 77, 0) 62%, rgba(12, 26, 48, 0.55) 100%);
}

.tile__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--blue-800);
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

.tile:active .tile__play,
.tile:focus-visible .tile__play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.tile__play svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

.tile__badge {
  position: absolute;
  top: 8px;
  left: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(229, 165, 54, 0.95);
  color: #3a2408;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.tile__duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(12, 26, 48, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tile__caption {
  padding: 8px 4px 0;
}

.tile__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* La miniature YouTube d'un short porte deja un sous-titre incruste au
   milieu de l'image: sans un titre plus marque sous la vignette, c'est ce
   texte genere qui capte l'attention plutot que le titre reel de la parole
   partagee. Les histoires racontees, elles, utilisent une illustration
   propre sans texte incruste et n'ont pas ce besoin. */
.tile:not(.tile--histoire) .tile__title {
  font-size: 16.5px;
  line-height: 1.22;
}

.tile__meta {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
}

.empty {
  padding: 44px 16px;
  text-align: center;
  color: var(--ink-soft);
}

.empty__emoji {
  font-size: 38px;
  line-height: 1;
}

.empty__title {
  margin: 12px 0 4px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

.empty__text {
  margin: 0;
  font-size: 14.5px;
}

/* Squelettes de chargement */
.tile--skeleton .tile__poster {
  background: linear-gradient(100deg, #e7e0d2 30%, #f3ece0 50%, #e7e0d2 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

.tile--skeleton .tile__title-bar {
  height: 11px;
  margin: 9px 4px 0;
  border-radius: 6px;
  background: #e7e0d2;
}

.tile--skeleton .tile__title-bar + .tile__title-bar {
  width: 62%;
  margin-top: 6px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Lecteur ---------- */

.screen--player {
  display: none;
  background: #0b1729;
  color: #fff;
}

.screen--player.is-active {
  display: flex;
  flex-direction: column;
}

.player__top {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player__position {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.player__position:empty {
  display: none;
}

/* Enchainer les shorts: fleches a portee du pouce, en bas a droite. */
.player__nav {
  float: right;
  display: flex;
  gap: 8px;
  margin: -4px 0 6px 12px;
}

.player__nav-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.player__nav-button:active {
  background: rgba(255, 255, 255, 0.26);
}

.player__nav-button svg {
  width: 24px;
  height: 24px;
}

.player__stage {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: calc(var(--safe-top) + 56px) 0 0;
}

.player__frame {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 9 / 16;
  max-height: 82dvh;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}

.player__frame--story {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #0b1729;
}

.player__frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.story-detail {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1729;
}

.story-detail__carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(94vw, 980px);
  align-items: center;
  gap: 14px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.42) transparent;
  padding: 4px max(3vw, calc((100vw - min(94vw, 980px)) / 2)) 10px;
}

.story-detail__carousel::-webkit-scrollbar {
  height: 8px;
}

.story-detail__carousel::-webkit-scrollbar-track {
  background: transparent;
}

.story-detail__carousel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.story-detail__card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  border-radius: 16px;
  overflow: hidden;
  scroll-snap-align: center;
  background: #111827;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
}

.story-detail__image {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  object-fit: contain;
  display: block;
  background: #0b1729;
}

.story-detail__overlay {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(8, 16, 28, 0.96);
}

.story-detail__episode {
  margin: 0;
  min-width: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.16;
}

.story-detail__play {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--rust-700);
  font-weight: 800;
}

.story-detail__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background: rgba(8, 16, 28, 0.72);
  color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  transform: translateY(-50%);
  cursor: pointer;
}

.story-detail__arrow:disabled {
  opacity: 0.28;
  cursor: default;
}

.story-detail__arrow svg {
  width: 24px;
  height: 24px;
}

.story-detail__arrow--previous {
  left: max(10px, env(safe-area-inset-left));
}

.story-detail__arrow--next {
  right: max(10px, env(safe-area-inset-right));
}

.story-player {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

.story-player__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-player__controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(11, 23, 41, 0.72);
  backdrop-filter: blur(12px);
}

.story-player__controls audio {
  display: block;
  width: 100%;
}

.story-player__play {
  position: absolute;
  left: 50%;
  bottom: 18px;
  min-width: 116px;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--rust-700);
  font-weight: 800;
  transform: translateX(-50%);
  box-shadow: var(--shadow-card);
}

.global-player {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: max(10px, var(--safe-bottom));
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 66px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  background: rgba(253, 247, 236, 0.94);
  box-shadow: 0 16px 40px rgba(18, 41, 77, 0.28);
  backdrop-filter: blur(16px);
}

.global-player__button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(27, 58, 107, 0.1);
  color: var(--blue-800);
}

.global-player__button[hidden] {
  display: none;
}

.global-player__button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.global-player__button--main {
  background: var(--blue-800);
  color: #fff;
  font-weight: 800;
}

.global-player__button--stop {
  color: var(--rust-700);
}

.global-player__now {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  background: transparent;
  text-align: left;
}

.global-player__kicker,
.global-player__title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-player__kicker {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 800;
}

.global-player__title {
  margin-top: 1px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
}

.global-player__progress {
  display: block;
  width: 100%;
  height: 18px;
  margin: 4px 0 0;
  accent-color: var(--blue-800);
}

.global-audio-active .screen--browse,
.global-audio-active .screen--admin {
  padding-bottom: calc(var(--safe-bottom) + 104px);
}

.player__sheet {
  flex: 0 0 auto;
  padding: 16px 18px calc(var(--safe-bottom) + 20px);
}

.player__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.22;
}

.player__meta {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--amber-200);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.player__summary {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  max-height: 22dvh;
  overflow-y: auto;
}

/* ---------- Admin ---------- */

.screen--admin {
  background: var(--paper-soft);
  padding-bottom: calc(var(--safe-bottom) + 28px);
}

.admin__bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 12px) 14px 12px;
  background: rgba(246, 241, 230, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.admin__title {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: var(--blue-800);
}

.text-button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--blue-800);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.admin__body {
  max-width: 820px;
  margin-inline: auto;
  padding: 16px 14px 0;
}

.admin-login {
  padding: 36px 20px;
  text-align: center;
}

.admin-login__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--blue-800);
}

.admin-login__text {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--blue-800);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button--ghost {
  background: var(--paper);
  color: var(--blue-800);
  border: 1px solid var(--line);
}

.admin-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.admin-filters::-webkit-scrollbar {
  display: none;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-stat {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.admin-stat strong {
  min-width: 0;
  overflow: hidden;
  color: var(--blue-800);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-stat span {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 900;
}

.admin-stat small {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-stat--wide {
  grid-column: 1 / -1;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 14px;
}

.admin-pagination:empty {
  display: none;
}

.admin-pagination .text-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.admin-pagination__label {
  color: var(--ink-faint);
  font-size: 12.5px;
  font-weight: 800;
}

@media (min-width: 720px) {
  .admin-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .admin-stat--wide {
    grid-column: span 2;
  }
}

/* ---------- Onglets admin ---------- */

.admin-tabs {
  display: flex;
  gap: 6px;
  padding: 2px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
}

.admin-tab {
  flex: 1 1 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.admin-tab.is-active {
  background: var(--blue-800);
  color: #fff;
}

.admin-tab--external {
  flex: 0 0 auto;
  background: rgba(27, 58, 107, 0.08);
  color: var(--blue-800);
}

/* ---------- Planning 2 ans ---------- */

.planning-list {
  margin-top: 8px;
}

.planning-empty {
  display: grid;
  gap: 10px;
  padding: 18px;
  margin-top: 12px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.planning-controls {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.planning-controls__toggle {
  display: flex;
  gap: 6px;
  width: min(100%, 360px);
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.planning-controls__button {
  flex: 1 1 0;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.planning-controls__button.is-active {
  background: var(--blue-800);
  color: #fff;
}

.planning-controls__month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.planning-controls__label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--blue-800);
  text-align: center;
}

.planning-controls__arrow {
  width: 36px;
  height: 36px;
}

.planning-agenda {
  display: grid;
  gap: 10px;
}

.planning-agenda__week {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.planning-agenda__week-label {
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: rgba(27, 58, 107, 0.08);
  color: var(--blue-800);
  font-size: 12px;
  font-weight: 900;
}

.planning-agenda__day {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 106px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.planning-agenda__day.is-outside {
  opacity: 0.48;
}

.planning-agenda__day-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.planning-agenda__day-heading strong {
  color: var(--blue-800);
  font-size: 13px;
  text-transform: none;
}

.planning-agenda__slot {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #ead9b7;
  border-radius: 10px;
  background: #fff8ea;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.planning-agenda__slot.has-video {
  border-color: #cfe8d4;
  background: #f3f8f4;
}

.planning-agenda__slot.is-locked {
  box-shadow: inset 0 0 0 2px rgba(229, 165, 54, 0.45);
}

.planning-agenda__slot-title,
.planning-agenda__slot-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.planning-agenda__slot-title {
  display: -webkit-box;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.18;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.planning-agenda__slot-meta {
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.planning-agenda__empty {
  margin: 0;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.planning-editor {
  border: 2px solid rgba(27, 58, 107, 0.16);
}

.planning-editor__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.planning-editor__title {
  margin: 0 0 3px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--blue-800);
}

.planning-editor__meta {
  margin: 0;
  color: var(--ink-faint);
  font-size: 12.5px;
  font-weight: 800;
}

.planning-editor__close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
}

.planning-editor__close svg {
  width: 18px;
  height: 18px;
}

.planning-editor__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.planning-editor__checkbox input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--blue-800);
}

@media (max-width: 620px) {
  .planning-agenda__week {
    grid-template-columns: 1fr;
  }

  .planning-agenda__week-label {
    min-height: 28px;
  }

  .planning-agenda__day {
    min-height: 0;
  }
}

.planning-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.planning-calendar__weekday {
  padding: 4px 2px 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.planning-calendar__day {
  position: relative;
  min-height: 92px;
  padding: 22px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  overflow: hidden;
}

.planning-calendar__day.is-outside {
  opacity: 0.45;
}

.planning-calendar__day.has-slot {
  background: #fff;
}

.planning-calendar__date {
  position: absolute;
  top: 5px;
  left: 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 900;
}

.planning-calendar__slots {
  display: grid;
  gap: 4px;
}

.planning-calendar__slot {
  display: grid;
  gap: 1px;
  width: 100%;
  min-width: 0;
  padding: 5px;
  border: 1px solid #ead9b7;
  border-radius: 8px;
  background: #fff8ea;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.planning-calendar__slot.has-video {
  border-color: #cfe8d4;
  background: #f3f8f4;
}

.planning-calendar__slot.is-locked {
  box-shadow: inset 0 0 0 2px rgba(229, 165, 54, 0.45);
}

.planning-calendar__slot-title,
.planning-calendar__slot-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-calendar__slot-title {
  font-size: 11px;
  font-weight: 900;
}

.planning-calendar__slot-meta {
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 800;
}

@media (max-width: 700px) {
  .planning-calendar {
    gap: 3px;
    padding: 5px;
    margin-inline: -8px;
  }

  .planning-calendar__day {
    min-height: 72px;
    padding: 18px 3px 3px;
    border-radius: 7px;
  }

  .planning-calendar__slot {
    padding: 4px;
  }

  .planning-calendar__slot-title {
    font-size: 9.5px;
  }

  .planning-calendar__slot-meta {
    display: none;
  }
}

.planning-list__month {
  margin: 20px 2px 8px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--blue-800);
}

.planning-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.planning-row--validated {
  background: #f3f8f4;
  box-shadow: none;
  border: 1px solid #cfe8d4;
}

.planning-row__date {
  flex: 0 0 auto;
  width: 58px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-faint);
  text-align: center;
}

.planning-row__main {
  flex: 1 1 auto;
  min-width: 0;
}

.planning-row__badges {
  flex: 0 0 auto;
}

.planning-row__lock {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--ink-faint);
}

.planning-row__lock svg {
  width: 18px;
  height: 18px;
}

.planning-row__lock.is-active {
  background: rgba(229, 165, 54, 0.18);
  color: var(--amber-600);
}

.planning-row__edit {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

@media (max-width: 620px) {
  .planning-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .planning-row__main {
    flex-basis: calc(100% - 68px);
  }

  .planning-row__badges {
    margin-left: 68px;
  }
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.admin-row__select {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--blue-800);
}

.admin-editor--schedule {
  border: 2px solid var(--blue-800);
}

.admin-row__main {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-row__title {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
}

.admin-row__meta {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.state--live { background: #dff3e3; color: #1c6b32; }
.state--live_scheduled { background: #dde9fb; color: #1b4c91; }
.state--live_unscheduled { background: #f4ecd9; color: #8a6416; }
.state--hidden { background: #f6e1dd; color: #94341f; }
.state--no_video { background: #ece9e4; color: #6b6154; }
.state--task-running { background: #dde9fb; color: #1b4c91; }
.state--task-pending { background: #f4ecd9; color: #8a6416; }
.state--task-success { background: #dff3e3; color: #1c6b32; }
.state--task-failed { background: #f6e1dd; color: #94341f; }
.state--task-muted { background: #ece9e4; color: #6b6154; }
.state--request-open { background: #f4ecd9; color: #8a6416; }
.state--request-planned { background: #dde9fb; color: #1b4c91; }
.state--request-in_progress { background: #efe2f6; color: #70428f; }
.state--request-done { background: #dff3e3; color: #1c6b32; }
.state--request-rejected { background: #ece9e4; color: #6b6154; }

.generation-actions {
  margin: 12px 0;
}

.generation-list {
  display: grid;
  gap: 8px;
}

.generation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.generation-row__main {
  flex: 1 1 auto;
  min-width: 0;
}

.generation-row__link {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

@media (max-width: 620px) {
  .generation-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .generation-row__main {
    flex-basis: 100%;
  }
}

.request-form {
  margin-top: 12px;
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.request-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.request-card__main {
  flex: 1 1 auto;
  min-width: 0;
}

.request-card__text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.42;
  white-space: pre-wrap;
}

.request-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.request-attachment {
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 999px;
  background: #edf4fb;
  color: var(--blue-800);
  font-size: 12.5px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

.request-card__resolution {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: #f3f8f4;
  color: var(--ink-soft);
  font-size: 13px;
}

.request-card__resolution p {
  margin: 0;
  white-space: pre-wrap;
}

.request-card__resolution small {
  color: var(--ink-faint);
  font-weight: 800;
}

.request-card__edit {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.request-edit {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

@media (max-width: 620px) {
  .request-card__head {
    display: grid;
  }
}

.admin-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.field {
  display: grid;
  gap: 5px;
}

.field > span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-soft);
  font-size: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.media-assets {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--paper-soft);
}

.media-assets__list {
  display: grid;
  gap: 6px;
}

.media-assets__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.media-assets__link {
  color: var(--blue-700);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.media-assets__replace {
  margin-top: 4px;
}

.background-admin {
  display: grid;
  gap: 16px;
}

.background-admin__group {
  display: grid;
  gap: 10px;
}

.background-admin__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-inline: 2px;
}

.background-admin__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.background-thumb {
  display: block;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-soft);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.background-thumb__img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: var(--paper-soft);
}

.background-thumb__label {
  display: block;
  overflow: hidden;
  padding: 7px 8px 9px;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-thumb .text-button {
  display: block;
  width: 100%;
  padding: 6px 8px 9px;
  font-size: 11.5px;
  text-align: center;
}

@media (min-width: 620px) {
  .background-admin__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Pull to refresh ---------- */

.refresh-indicator {
  position: fixed;
  /* Sous la barre collante, pour ne pas recouvrir le titre. */
  top: calc(var(--safe-top) + 64px);
  left: 50%;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--blue-800);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translate(-50%, -24px);
  pointer-events: none;
}

.refresh-indicator__icon {
  width: 20px;
  height: 20px;
}

.refresh-indicator.is-armed {
  background: var(--blue-800);
  color: #fff;
}

.refresh-indicator.is-spinning .refresh-indicator__icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 22px);
  z-index: 70;
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(18, 41, 77, 0.95);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

/* Repere visuel discret quand la PWA tourne sur dev.*, pour ne jamais
   confondre l'environnement de test avec la prod (bascule JS sur hostname:
   voir env-badge dans app.js). Ne s'affiche jamais tel quel si le JS ne
   retire pas [hidden], donc sans risque meme si ce fichier finit sur main. */
.env-badge {
  position: fixed;
  top: max(8px, var(--safe-top));
  left: 8px;
  z-index: 90;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--rust-500);
  color: #fff;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}
