/* =========================================================================
   Qrible, dans l’esprit d’iOS 26 (Liquid Glass).
   La caméra occupe tout l'écran ; les contrôles flottent dessus en verre.
   Le résultat arrive dans une feuille translucide avec poignée, contenu en
   listes groupées façon Réglages. Couleurs système d'Apple, variantes
   « contraste élevé » quand il le faut pour l'accessibilité (AA).
   ========================================================================= */

@font-face {
  font-family: 'Geist';
  src: url('../fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Sur iPhone : SF Pro / SF Mono natifs. Ailleurs : Geist, très proche. */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Geist', system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Geist', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Geist Mono', monospace;

  /* Échelle typographique iOS (Dynamic Type, taille « Grand ») */
  --large-title: 2.125rem; /* 34 */
  --title-1: 1.75rem; /* 28 */
  --title-2: 1.375rem; /* 22 */
  --title-3: 1.25rem; /* 20 */
  --body: 1.0625rem; /* 17 */
  --subhead: 0.9375rem; /* 15 */
  --footnote: 0.8125rem; /* 13 */

  /* Couleurs système (clair) */
  --bg-grouped: #f2f2f7;
  --bg-cell: #ffffff;
  --label: #000000;
  --label-2: #6c6c70; /* secondaryLabel, variante contraste élevé */
  --separator: rgb(60 60 67 / 0.2);
  --fill: rgb(120 120 128 / 0.14);
  /* Bleu interactif assombri pour rester AA (≥ 4,5) sur les fonds gris. */
  --blue: #005fbf;
  --green: #248a3d;
  --orange: #c93400;
  --red: #d70015;
  --gray: #6c6c70;
  --indigo: #3634a3;

  /* Matériaux Liquid Glass */
  --glass-sheet: rgb(250 250 252 / 0.93);
  --glass-control: rgb(255 255 255 / 0.2);
  --glass-edge: rgb(255 255 255 / 0.42);
  --glass-blur: blur(22px) saturate(1.8);

  --radius-sheet: 34px;
  --radius-group: 16px;
  --ease-spring: cubic-bezier(0.22, 1.1, 0.36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-grouped: #000000;
    --bg-cell: #1c1c1e;
    --label: #ffffff;
    --label-2: #98989f;
    --separator: rgb(84 84 88 / 0.55);
    --fill: rgb(118 118 128 / 0.24);
    --blue: #409cff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff6961;
    --gray: #98989f;
    --glass-sheet: rgb(28 28 30 / 0.92);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: #000;
  color: var(--label);
  font-family: var(--font);
  font-size: var(--body);
  line-height: 1.29;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button,
input,
a {
  font: inherit;
  color: inherit;
}
button {
  -webkit-user-select: none;
  user-select: none;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

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

/* Pictogrammes */
.symbol {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
[data-icon] {
  display: inline-grid;
  place-items: center;
}

/* ======================================================= Boutons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 3.125rem;
  padding: 0.8rem 1.4rem;
  border: 0;
  border-radius: 999px;
  font-weight: 600;
  font-size: var(--body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.18s var(--ease-spring),
    opacity 0.18s;
}
.button:active {
  transform: scale(0.97);
  opacity: 0.85;
}
.button .symbol {
  font-size: 1.1rem;
}
.button-large {
  min-height: 3.5rem;
  width: 100%;
}
.button-filled {
  background: var(--blue);
  color: #fff;
}
.button-gray {
  background: var(--fill);
  color: var(--blue);
}
.button-plain {
  background: transparent;
  color: var(--blue);
  min-height: 2.75rem;
}
.button-plain.destructive {
  color: var(--red);
}
@media (prefers-color-scheme: dark) {
  .button-filled {
    background: #0071e3;
  }
}

/* ======================================================= Caméra */

.camera {
  --zoom: 1;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
  color: #fff;
  /* Le pincement agrandit l'image de la caméra, pas la page. */
  touch-action: none;
}

.camera video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.camera[data-state='live'] video {
  opacity: 1;
}
/* Caméra arrière : jamais d'effet miroir (la bibliothèque l'applique aux caméras frontales). */
.camera video {
  transform: none !important;
}

/* Zoom numérique : l'image s'agrandit autour du centre du halo (zoom.js, HALO_CENTER).
   La propriété scale ne touche pas au transform que la bibliothèque pose sur la vidéo. */
.camera video,
.frame {
  scale: var(--zoom);
  transform-origin: 50% 42%;
}
@media (prefers-reduced-motion: no-preference) {
  .camera video {
    transition:
      opacity 0.35s ease,
      scale 0.3s var(--ease-spring);
  }
}

.frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.camera[data-state='frozen'] .frame {
  display: block;
}

/* ---- Halo de visée (esprit Apple Intelligence) ---- */

@property --halo-angle {
  syntax: '<angle>';
  inherits: true;
  initial-value: 0deg;
}

.scan-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 60% at 50% 42%, transparent 45%, rgb(0 0 0 / 0.45) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.camera[data-state='live'] .scan-vignette {
  opacity: 1;
}

.halo {
  --halo-colors: #5b8cff, #8f6bff, #e45cff, #ff5f8f, #ff9a4d, #ffd36b, #6be0ff, #5b8cff;
  --halo-radius: 46px;
  position: absolute;
  left: 50%;
  top: 42%;
  /* Taille bornée aussi par la hauteur : l'app peut être affichée dans un cadre court. */
  width: min(70vw, 17.5rem, 46dvh);
  height: min(70vw, 17.5rem, 46dvh);
  translate: -50% -50%;
  border-radius: var(--halo-radius);
  opacity: 0;
  scale: 0.92;
  pointer-events: none;
  transition:
    opacity 0.45s ease,
    scale 0.6s var(--ease-spring),
    left 0.55s var(--ease-spring),
    top 0.55s var(--ease-spring),
    width 0.55s var(--ease-spring),
    height 0.55s var(--ease-spring),
    rotate 0.55s var(--ease-spring),
    border-radius 0.55s var(--ease-spring);
}
.camera[data-state='live'] .halo,
.camera[data-detected] .halo {
  opacity: 1;
  scale: 1;
}

/* Le liseré net : dégradé conique qui tourne, masqué pour ne garder que le bord. */
.halo-ring,
.halo-glow {
  position: absolute;
  border-radius: inherit;
  background: conic-gradient(from var(--halo-angle), var(--halo-colors));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
}
.halo-ring {
  inset: 0;
  padding: 3px;
}
/* La lueur : le même dégradé, plus épais et flouté. */
.halo-glow {
  inset: -14px;
  padding: 18px;
  border-radius: calc(var(--halo-radius) + 14px);
  filter: blur(16px);
  opacity: 0.8;
  transition:
    filter 0.4s ease,
    opacity 0.4s ease;
}

/* Code verrouillé : le halo épouse le code, la lueur se resserre et s'intensifie. */
.camera[data-detected] .halo {
  --halo-radius: 16px;
}
.halo.is-locked .halo-ring {
  padding: 4px;
}
.halo.is-locked .halo-glow {
  filter: blur(9px);
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .halo {
    animation:
      halo-spin 3.2s linear infinite,
      halo-breathe 3.2s ease-in-out infinite;
  }
  .halo.is-locked {
    animation:
      halo-spin 1.1s linear infinite,
      halo-pulse 0.5s var(--ease-spring);
  }
  @keyframes halo-spin {
    to {
      --halo-angle: 360deg;
    }
  }
  @keyframes halo-breathe {
    50% {
      scale: 1.018;
    }
  }
  @keyframes halo-pulse {
    40% {
      scale: 1.07;
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  .halo {
    transition: opacity 0.2s ease;
  }
}

/* Capsule du domaine sous le code détecté */
.code-outline {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.code-chip {
  position: absolute;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 80vw;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.88);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  color: #000;
  font-size: var(--subhead);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
}
.code-chip .symbol {
  font-size: 1rem;
  stroke-width: 2.1;
  color: #6c6c70;
}
@media (prefers-reduced-motion: no-preference) {
  .code-chip {
    animation: chip-in 0.4s 0.25s var(--ease-spring) backwards;
  }
  @keyframes chip-in {
    from {
      opacity: 0;
      transform: translateY(-8px) scale(0.9);
    }
  }
}

/* Écran d'autorisation (caméra éteinte) */
.permission {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  padding: 2rem 2.25rem 9rem;
  text-align: center;
}
.camera[data-state='live'] .permission,
.camera[data-state='frozen'] .permission {
  display: none;
}
.permission-glyph {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  color: rgb(255 255 255 / 0.9);
}
.permission-glyph .symbol {
  stroke-width: 1.4;
}
/* Fond caméra toujours sombre : bleu clair, lisible (contraste 7,4). */
.permission .button-plain {
  color: #409cff;
}
.permission h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--title-2);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.permission p {
  margin: 0 0 1rem;
  max-width: 30ch;
  color: rgb(235 235 245 / 0.7);
  font-size: var(--subhead);
  line-height: 1.4;
}

/* Contrôles flottants en verre */
.camera-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: calc(env(safe-area-inset-top) + 0.75rem) 1rem 0;
  pointer-events: none;
}
.camera-top > * {
  pointer-events: auto;
}

/* Une feuille est ouverte : les contrôles de la caméra s'effacent. */
.camera-top,
.camera-bottom {
  transition: opacity 0.2s ease;
}
body:has(dialog[open]) .camera-top,
body:has(dialog[open]) .camera-bottom {
  opacity: 0;
  visibility: hidden;
}
.camera-top #open-help {
  order: -2;
}
.camera-top #torch {
  order: -1;
}
/* Logo en haut à droite, dans une capsule de verre comme les autres contrôles. */
.glass-logo {
  display: inline-flex;
  align-items: center;
  height: 2.875rem;
  margin-left: auto;
  padding: 0 0.85rem 0 0.5rem;
  border-radius: 999px;
}
.glass-logo img {
  display: block;
  width: auto;
  height: 1.875rem;
}
.glass-logo:active {
  transform: scale(0.96);
}

.glass-button,
.glass-logo,
.glass-bar {
  background: var(--glass-control);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.45),
    inset 0 -1px 0 rgb(255 255 255 / 0.08),
    0 8px 30px rgb(0 0 0 / 0.18);
  color: #fff;
}

.glass-button {
  display: grid;
  place-items: center;
  width: 2.875rem;
  height: 2.875rem;
  padding: 0;
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-spring),
    background-color 0.2s;
}
.glass-button:active {
  transform: scale(0.92);
}
.glass-button[aria-pressed='true'] {
  background: #ffd60a;
  color: #000;
  border-color: #ffd60a;
}

.camera-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 0 1rem calc(env(safe-area-inset-bottom) + 1.25rem);
}

.camera-hint {
  margin: 0;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.42);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: var(--subhead);
  font-weight: 600;
  text-align: center;
}
.camera-hint:empty {
  display: none;
}

/* Paliers de zoom : petites pastilles de verre, la valeur active en jaune comme sur iOS. */
.zoom-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.28);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.camera:not([data-state='live']) .zoom-bar {
  display: none;
}
.zoom-button {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.4rem;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.16);
  color: #fff;
  font-size: var(--footnote);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-spring),
    background-color 0.2s;
}
.zoom-button[aria-pressed='true'] {
  background: rgb(0 0 0 / 0.55);
  color: #ffd60a;
  font-size: var(--subhead);
}
.zoom-button:active {
  transform: scale(0.92);
}
.zoom-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 1px;
}

.glass-bar {
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
}
.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.875rem;
  padding: 0.5rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: var(--subhead);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}
.glass-pill:active {
  background: rgb(255 255 255 / 0.18);
}
.glass-pill .symbol {
  font-size: 1.25rem;
}
.glass-pill:focus-within {
  outline: 3px solid #fff;
  outline-offset: 1px;
}

/* ======================================================= Bienvenue */

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--bg-cell);
  color: var(--label);
}
/* Le contenu défile si l'écran est court ; « Continuer » reste toujours visible. */
.onboarding-content {
  flex: 1 1 auto;
  display: grid;
  align-content: center;
  width: min(100%, 26rem);
  margin-inline: auto;
  padding: calc(env(safe-area-inset-top) + 2.5rem) 2rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.onboarding-title {
  margin: 0 0 2.75rem;
  font-family: var(--font-display);
  font-size: var(--large-title);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-align: center;
  text-wrap: balance;
}
.features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.85rem;
}
.features li {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: 1.1rem;
  align-items: start;
}
.feature-glyph {
  font-size: 2.35rem;
  color: var(--blue);
}
.feature-glyph .symbol {
  stroke-width: 1.6;
}
.features h3 {
  margin: 0 0 0.15rem;
  font-size: var(--subhead);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.features p {
  margin: 0;
  color: var(--label-2);
  font-size: var(--subhead);
  line-height: 1.35;
}
.onboarding-footer {
  flex: none;
  width: min(100%, 26rem);
  margin-inline: auto;
  padding: 1rem 2rem calc(env(safe-area-inset-bottom) + 1.5rem);
  text-align: center;
}
.onboarding-footer p {
  margin: 0 0 1rem;
  color: var(--label-2);
  font-size: var(--footnote);
}

/* ======================================================= Feuilles */

dialog {
  padding: 0;
  border: 0;
  color: var(--label);
}

.sheet {
  position: fixed;
  inset: auto 0 0;
  width: min(100% - 16px, 32rem);
  max-width: none;
  max-height: calc(100dvh - env(safe-area-inset-top) - 2.5rem);
  margin: 0 auto 8px;
  display: none;
  flex-direction: column;
  border-radius: var(--radius-sheet);
  background: var(--glass-sheet);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  backdrop-filter: blur(40px) saturate(1.8);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.35),
    0 -10px 50px rgb(0 0 0 / 0.25);
  overflow: hidden;
}
.sheet[open] {
  display: flex;
}
.sheet::backdrop {
  background: rgb(0 0 0 / 0.22);
}

.sheet-handle {
  position: relative;
  flex: none;
  height: 3.25rem;
  cursor: grab;
  touch-action: none;
}
.grabber {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 36px;
  height: 5px;
  translate: -50% 0;
  border-radius: 3px;
  background: rgb(127 127 127 / 0.45);
}
.close-button {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--label-2);
  font-size: 1.05rem;
  cursor: pointer;
}
.close-button .symbol {
  stroke-width: 2.4;
}
.close-button::after {
  content: '';
  position: absolute;
  inset: -0.5rem;
} /* cible tactile 48 px */

/* Base « auto » (hauteur du contenu) et non 0 % : la feuille n'a pas de hauteur fixe,
   seulement un max-height, et Safari iOS réduisait alors la zone à son seul padding.
   min-height: 0 la laisse se réduire et défiler quand le contenu dépasse. */
.sheet-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 1rem 1rem;
}
.sheet-footer {
  flex: none;
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 1rem calc(env(safe-area-inset-bottom) + 0.9rem);
}
.sheet-footer:empty {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] {
    animation: sheet-in 0.5s var(--ease-spring);
  }
  .sheet.is-closing {
    animation: sheet-out 0.26s ease-in forwards;
  }
  .sheet[open]::backdrop {
    animation: fade-in 0.3s ease;
  }
  @keyframes sheet-in {
    from {
      transform: translateY(105%);
    }
  }
  @keyframes sheet-out {
    to {
      transform: translateY(105%);
    }
  }
  @keyframes fade-in {
    from {
      opacity: 0;
    }
  }
}

/* ---- En-tête du verdict ---- */

.verdict {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem 1.5rem;
  text-align: center;
}
.verdict-glyph {
  display: grid;
  place-items: center;
  width: 4.25rem;
  height: 4.25rem;
  margin-bottom: 0.65rem;
  border-radius: 50%;
  background: var(--tone, var(--gray));
  color: #fff;
  font-size: 2.1rem;
}
.verdict-glyph .symbol {
  stroke-width: 2.6;
}
.tone-safe {
  --tone: var(--green);
}
.tone-caution {
  --tone: var(--orange);
}
.tone-danger {
  --tone: var(--red);
}
.tone-unknown,
.tone-neutral {
  --tone: var(--gray);
}
.tone-info {
  --tone: var(--blue);
}
@media (prefers-color-scheme: dark) {
  .tone-safe .verdict-glyph,
  .tone-caution .verdict-glyph {
    color: #000;
  }
}

.verdict-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--title-1);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.verdict-title:focus {
  outline: none;
} /* focus programmatique : simple point d'ancrage */
.verdict-text {
  margin: 0;
  max-width: 30ch;
  color: var(--label-2);
  font-size: var(--subhead);
  line-height: 1.35;
}

/* Le domaine, en capsule : sous-domaine estompé, domaine enregistrable net. */
.domain-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  margin-top: 0.8rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--fill);
  font-family: var(--mono);
  font-size: var(--subhead);
  line-height: 1.25;
  text-align: left;
}
.domain-pill .symbol {
  font-size: 1rem;
  color: var(--label-2);
}
.domain-pill .host {
  overflow-wrap: anywhere;
}
.domain-pill .sub {
  color: var(--label-2);
}
.domain-pill .reg {
  font-weight: 600;
}

/* ---- Panneau de résultat (niveau 1) ----
   Dans l'esprit des alertes d'Apple : pas de bloc de couleur, la feuille garde
   son verre. Un grand pictogramme coloré sur un halo, le verdict en couleur,
   le reste en couleur de texte. Couleurs système : AA en clair comme en sombre. */
.panel {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.5rem 0.25rem;
  text-align: center;
}
.panel.tone-clear {
  --tone: var(--green);
}
.panel-glyph {
  position: relative;
  display: grid;
  place-items: center;
  width: 6rem;
  height: 6rem;
  margin-bottom: 0.35rem;
  color: var(--tone, var(--gray));
  font-size: 4.25rem;
}
/* Halo : la couleur du verdict, diffuse, comme le liseré du scanner. */
.panel-glyph::before {
  content: '';
  position: absolute;
  inset: -0.9rem;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--tone, var(--gray)) 30%, transparent) 0%,
    color-mix(in srgb, var(--tone, var(--gray)) 10%, transparent) 45%,
    transparent 70%
  );
}
.panel.tone-neutral .panel-glyph::before {
  content: none;
}
.panel-glyph .symbol {
  stroke-width: 1.7;
}
.panel-glyph .activity {
  margin: 0;
}
.panel-title {
  margin: 0;
  color: var(--tone, var(--label));
  font-family: var(--font-display);
  font-size: clamp(2rem, 8.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
/* Rien de reconnu : le vert reste sur le pictogramme, pas sur le titre. */
.panel.tone-clear .panel-title,
.panel.tone-neutral .panel-title {
  color: var(--label);
}
.panel-title:focus {
  outline: none;
} /* focus programmatique : simple point d'ancrage */
.panel-text {
  margin: 0;
  max-width: 26ch;
  color: var(--label);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.3;
  text-wrap: balance;
}
.panel .domain-pill {
  margin-top: 0.75rem;
}
.panel-listen {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--blue);
  font-size: 1.3rem;
  cursor: pointer;
}
.panel-listen[aria-pressed='true'] {
  background: var(--blue);
  color: #fff;
}
@media (prefers-reduced-motion: no-preference) {
  .panel:not(.tone-neutral) .panel-glyph {
    animation: panel-pop 0.55s var(--ease-spring) both;
  }
  .panel:not(.tone-neutral) .panel-glyph::before {
    animation: fade-in 0.8s ease both;
  }
  @keyframes panel-pop {
    from {
      opacity: 0;
      scale: 0.6;
    }
  }
}
.panel-note {
  margin: -0.25rem 1rem 0.25rem;
  color: var(--label-2);
  font-size: var(--subhead);
  text-align: center;
}
.pending-note {
  margin: 0 1rem;
  color: var(--label-2);
  font-size: var(--subhead);
  text-align: center;
}

/* ---- « En savoir plus » (niveau 2) et « Détails techniques » (niveau 3) ---- */
.more > summary,
.technical > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  color: var(--blue);
  font-size: var(--body);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.more > summary::-webkit-details-marker,
.technical > summary::-webkit-details-marker {
  display: none;
}
.more .chevron,
.technical .chevron {
  font-size: 0.85rem;
  rotate: 90deg;
  transition: rotate 0.25s var(--ease-spring);
}
.more[open] > summary .chevron,
.technical[open] > summary .chevron {
  rotate: -90deg;
}
.reason {
  margin: 0.5rem 0.25rem 0;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  text-wrap: pretty;
}
.technical {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--separator);
}
.technical > summary {
  color: var(--label-2);
  font-size: var(--subhead);
}
.technical > .domain-pill {
  display: flex;
  width: fit-content;
  margin: 0.25rem auto 0;
}
.route .row-text {
  font-family: var(--mono);
  font-size: var(--footnote);
  overflow-wrap: anywhere;
}

/* Indicateur d'activité iOS (12 branches) */
.activity {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  margin: 1.25rem 0 1rem;
  color: var(--label-2);
}
.activity i {
  position: absolute;
  left: 50%;
  top: 0;
  width: 3px;
  height: 28%;
  margin-left: -1.5px;
  border-radius: 2px;
  background: currentColor;
  transform-origin: 50% 180%;
  opacity: 0.25;
}
@media (prefers-reduced-motion: no-preference) {
  .activity i {
    animation: spoke 1s linear infinite;
  }
  @keyframes spoke {
    from {
      opacity: 1;
    }
    to {
      opacity: 0.25;
    }
  }
}

/* ---- Listes groupées (Réglages) ---- */

.group-header {
  margin: 1.25rem 1rem 0.45rem;
  color: var(--label-2);
  font-size: var(--footnote);
  font-weight: 400;
  letter-spacing: 0;
}
.group-footer {
  margin: 0.5rem 1rem 0;
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.35;
}

.group {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-group);
  background: var(--bg-cell);
  overflow: hidden;
}
.sheet .group,
.sheet .disclosure {
  background: color-mix(in srgb, var(--bg-cell) 90%, transparent);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  font-size: var(--body);
  line-height: 1.3;
}
.row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 3.65rem; /* séparateur aligné sur le texte, comme iOS */
  height: 1px;
  background: var(--separator);
  transform: scaleY(0.5);
  transform-origin: top;
}
.row-text {
  min-width: 0;
  text-wrap: pretty;
}
.row-text small {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--footnote);
}
.row-label {
  color: var(--label);
}
.row-value {
  color: var(--label-2);
  text-align: right;
  overflow-wrap: anywhere;
}
.row a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}
/* Un lien dans un texte se distingue autrement que par sa couleur. */
.row-text small a,
.group-footer a,
.prose a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.row.value-row {
  grid-template-columns: auto 1fr;
}
/* Ligne entièrement cliquable (lien ou bouton étiré), comme une cellule de Réglages. */
.row.link-row a,
.row.link-row button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--label);
  font: inherit;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}
.row.link-row a::after,
.row.link-row button::after {
  content: '';
  position: absolute;
  inset: 0;
}
.row.link-row a:focus-visible,
.row.link-row button:focus-visible {
  outline: none;
}
.row.link-row:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
  border-radius: var(--radius-group);
}
.row.link-row .row-text > button {
  display: block;
  width: 100%;
}
/* Sous-titre d'une ligne (exemples du mode démo) : sous le titre, aligné à gauche. */
.row-detail {
  display: block;
  margin-top: 0.2rem;
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.3;
  text-align: left;
}
.row-chevron {
  color: var(--label-2);
}
.row.value-row + .row::before {
  left: 1rem;
}

.squircle {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  align-self: start;
}
.squircle .symbol {
  stroke-width: 2.2;
}
.squircle.red {
  background: var(--red);
}
.squircle.orange {
  background: var(--orange);
}
.squircle.green {
  background: var(--green);
}
.squircle.blue {
  background: var(--blue);
}
.squircle.gray {
  background: var(--gray);
}
.squircle.indigo {
  background: var(--indigo);
}
@media (prefers-color-scheme: dark) {
  .squircle.green,
  .squircle.orange {
    color: #000;
  }
  .squircle.indigo {
    background: #5e5ce6;
  }
}

/* Mise en garde sous chaque résultat. */
.disclaimer {
  margin: 1.25rem 1rem 0.25rem;
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.35;
}

/* Mode démo : rappel discret que le résultat est un exemple. */
.demo-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--indigo) 14%, transparent);
  color: var(--indigo);
  font-size: var(--footnote);
}
.demo-notice .symbol {
  font-size: 1rem;
}
@media (prefers-color-scheme: dark) {
  .demo-notice {
    background: rgb(94 92 230 / 0.22);
    color: #a5a4ff;
  }
}

/* Ligne dépliable (parcours du lien) */
.disclosure {
  margin-top: 1.25rem;
  border-radius: var(--radius-group);
  background: var(--bg-cell);
}
.disclosure summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  list-style: none;
}
.disclosure summary::-webkit-details-marker {
  display: none;
}
.disclosure .chevron {
  color: var(--label-2);
  font-size: 0.95rem;
  transition: rotate 0.25s var(--ease-spring);
}
.disclosure .chevron .symbol {
  stroke-width: 2.4;
}
.disclosure[open] .chevron {
  rotate: 90deg;
}
.disclosure ol {
  margin: 0;
  padding: 0.1rem 1rem 1rem 3.65rem;
  color: var(--label-2);
  font-family: var(--mono);
  font-size: var(--footnote);
  overflow-wrap: anywhere;
}
.disclosure li + li {
  margin-top: 0.4rem;
}

.prose {
  margin: 0 0.25rem 0.75rem;
  color: var(--label);
  font-size: var(--body);
  line-height: 1.4;
}
.sheet-large-title {
  margin: 0 0.25rem 0.9rem;
  font-family: var(--font-display);
  font-size: var(--large-title);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.help-sheet {
  max-height: calc(100dvh - env(safe-area-inset-top) - 1rem);
}
.help-sheet .sheet-scroll {
  padding-bottom: calc(env(safe-area-inset-bottom) + 1.5rem);
}

/* ======================================================= Feuille d'actions */

.action-sheet {
  position: fixed;
  inset: auto 0 0;
  width: min(100% - 16px, 28rem);
  max-width: none;
  margin: 0 auto calc(env(safe-area-inset-bottom) + 8px);
  background: transparent;
  overflow: visible;
}
.action-sheet[open] {
  display: grid;
  gap: 8px;
}
.action-sheet::backdrop {
  background: rgb(0 0 0 / 0.4);
}
.action-group,
.action-cancel {
  border-radius: 14px;
  background: rgb(250 250 252 / 0.96);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  backdrop-filter: blur(30px) saturate(1.8);
  overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  .action-group,
  .action-cancel {
    background: rgb(44 44 46 / 0.92);
  }
}
.action-header {
  padding: 1rem 1rem 0.9rem;
  text-align: center;
  border-bottom: 1px solid var(--separator);
}
.action-title {
  margin: 0 0 0.2rem;
  color: var(--label-2);
  font-size: var(--footnote);
  font-weight: 600;
}
.action-message {
  margin: 0;
  color: var(--label-2);
  font-size: var(--footnote);
}
.action-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 3.5rem;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: var(--title-3);
  text-decoration: none;
  cursor: pointer;
}
.action-button.destructive {
  color: var(--red);
}
.action-button.action-cancel {
  font-weight: 600;
  background: rgb(250 250 252 / 0.96);
}
@media (prefers-color-scheme: dark) {
  .action-button.action-cancel {
    background: rgb(44 44 46 / 0.96);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .action-sheet[open] {
    animation: sheet-in 0.45s var(--ease-spring);
  }
}

/* ======================================================= HUD */

.hud {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 50;
  translate: -50% -50%;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  min-width: 9rem;
  padding: 1.25rem 1.5rem 1rem;
  border-radius: 18px;
  background: rgb(30 30 32 / 0.72);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  color: #fff;
  font-size: var(--subhead);
  font-weight: 600;
  pointer-events: none;
}
.hud .symbol {
  font-size: 2.25rem;
  stroke-width: 2.2;
}
@media (prefers-reduced-motion: no-preference) {
  .hud:not([hidden]) {
    animation: hud-in 0.35s var(--ease-spring);
  }
  @keyframes hud-in {
    from {
      opacity: 0;
      scale: 0.85;
    }
  }
}

/* ======================================================= Écrans courts
   (petits iPhone, ou app affichée dans un cadre sous d'autres barres) */

@media (max-height: 760px) {
  .onboarding-content {
    padding-top: calc(env(safe-area-inset-top) + 1.5rem);
  }
  .onboarding-title {
    margin-bottom: 1.5rem;
    font-size: var(--title-1);
  }
  .features {
    gap: 1.1rem;
  }
  .features li {
    grid-template-columns: 2.25rem 1fr;
    gap: 0.9rem;
  }
  .feature-glyph {
    font-size: 1.9rem;
  }
  .onboarding-footer {
    padding-top: 0.75rem;
    padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
  }
  .onboarding-footer p {
    margin-bottom: 0.6rem;
  }
}

@media (max-height: 700px) {
  .camera-bottom {
    gap: 0.6rem;
    padding-bottom: calc(env(safe-area-inset-bottom) + 0.75rem);
  }
  .camera-top {
    padding-top: calc(env(safe-area-inset-top) + 0.5rem);
  }
  .sheet {
    max-height: calc(100dvh - env(safe-area-inset-top) - 0.75rem);
    margin-bottom: 6px;
  }
  .sheet-handle {
    height: 2.5rem;
  }
  .close-button {
    top: 0.5rem;
  }
  .panel {
    gap: 0.2rem;
    margin-bottom: 0.25rem;
    padding-top: 0.25rem;
  }
  .panel-glyph {
    width: 4.25rem;
    height: 4.25rem;
    margin-bottom: 0.2rem;
    font-size: 3.1rem;
  }
  .panel-title {
    font-size: 1.8rem;
  }
  .panel-text {
    font-size: 1.05rem;
  }
  .panel .domain-pill {
    margin-top: 0.5rem;
  }
  .verdict {
    padding-bottom: 0.9rem;
    gap: 0.2rem;
  }
  .verdict-glyph {
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: 0.35rem;
    font-size: 1.6rem;
  }
  .verdict-title {
    font-size: var(--title-2);
  }
  .domain-pill {
    margin-top: 0.5rem;
  }
  .group-header {
    margin-top: 0.9rem;
  }
  .sheet-footer {
    padding-top: 0.5rem;
    padding-bottom: calc(env(safe-area-inset-bottom) + 0.6rem);
  }
  .button-large {
    min-height: 3rem;
  }
  .sheet-large-title {
    font-size: var(--title-1);
  }
}

.noscript {
  position: fixed;
  inset: auto 0 0;
  padding: 1rem;
  background: #fff;
  color: #000;
  text-align: center;
}
