@font-face {
  font-family: "Funnel Display";
  src: url("/fonts/funnel-display.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

@font-face {
  font-family: "Funnel Sans";
  src: url("/fonts/funnel-sans.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

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

:root {
  --brand-disc: #16130f;
  --brand-pad: 6px;
  --bg: #f6f3ef;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --sunken: #ece8e2;
  --ink: #16130f;
  --ink-2: #57504a;
  --ink-3: #6b635b;
  --line: #e7e2db;
  --line-strong: #d2cbc2;
  --accent: #ff6a1a;
  --accent-strong: #f25a08;
  --accent-ink: #16130f;
  --accent-soft: #ffe3d1;
  --accent-text: #b23f08;
  --success: #156b40;
  --success-soft: #d5f0df;
  --danger: #b92a1a;
  --danger-soft: #fbe1dc;
  --warning: #7d5200;
  --warning-soft: #fbe6bd;
  --tonal: #ece8e2;
  --tile-deep: #16130f;
  --tile-deep-ink: #f6f3ef;
  --tile-deep-muted: #b9b2a9;
  --tile-deep-raised: #2e2a26;
  --toast-bg: #16130f;
  --toast-ink: #f6f3ef;
  --focus: #16130f;
  --liquid-bg: #ece8e2;
  --liquid-back: #ffb07a;
  --liquid-front: #ff6a1a;
  --liquid-ink: #16130f;
  --shadow-1: 0 1px 2px rgb(22 19 15 / 0.06);
  --shadow-2: 0 10px 28px -12px rgb(22 19 15 / 0.2);
  --shadow-3: 0 24px 60px -20px rgb(22 19 15 / 0.34);
  --font-ui: "Funnel Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Funnel Display", "Funnel Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-2xl: 44px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: linear(0, 0.051, 0.174, 0.329, 0.491, 0.641, 0.769, 0.872, 0.948, 1.001, 1.035, 1.052, 1.058, 1.056, 1.05, 1.041, 1.032, 1.023, 1.015, 1.009, 1.004, 1, 0.998, 0.997, 0.997, 0.997, 1);
  --spring-bouncy: linear(0, 0.045, 0.156, 0.304, 0.465, 0.621, 0.761, 0.878, 0.969, 1.034, 1.077, 1.1, 1.107, 1.103, 1.092, 1.076, 1.059, 1.042, 1.027, 1.014, 1.004, 0.997, 0.992, 0.99, 0.989, 0.989, 0.99, 0.992, 0.994, 0.995, 1);
  --spring-t: 480ms;
  --fast: 160ms;
  --mid: 280ms;
  --slow: 520ms;
  --gutter: clamp(16px, 3vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-disc: transparent;
    --brand-pad: 3px;
    --bg: #0e0d0c;
    --surface: #1a1917;
    --surface-2: #211f1d;
    --sunken: #131211;
    --ink: #f4f1ec;
    --ink-2: #b9b2a9;
    --ink-3: #9d958c;
    --line: #2a2826;
    --line-strong: #45413d;
    --accent: #ff7a2e;
    --accent-strong: #ff9150;
    --accent-ink: #16130f;
    --accent-soft: #3a2414;
    --accent-text: #ff9a5c;
    --success: #5fd699;
    --success-soft: #143424;
    --danger: #ff8a7a;
    --danger-soft: #45190f;
    --warning: #f0b94a;
    --warning-soft: #3d2c08;
    --tonal: #2b2926;
    --tile-deep: #242220;
    --tile-deep-raised: #383532;
    --toast-bg: #f4f1ec;
    --toast-ink: #16130f;
    --focus: #f4f1ec;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 12px 30px -14px rgb(0 0 0 / 0.7);
    --shadow-3: 0 26px 70px -20px rgb(0 0 0 / 0.85);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --brand-disc: transparent;
  --brand-pad: 3px;
  --bg: #0e0d0c;
  --surface: #1a1917;
  --surface-2: #211f1d;
  --sunken: #131211;
  --ink: #f4f1ec;
  --ink-2: #b9b2a9;
  --ink-3: #9d958c;
  --line: #2a2826;
  --line-strong: #45413d;
  --accent: #ff7a2e;
  --accent-strong: #ff9150;
  --accent-ink: #16130f;
  --accent-soft: #3a2414;
  --accent-text: #ff9a5c;
  --success: #5fd699;
  --success-soft: #143424;
  --danger: #ff8a7a;
  --danger-soft: #45190f;
  --warning: #f0b94a;
  --warning-soft: #3d2c08;
  --tonal: #2b2926;
  --tile-deep: #242220;
  --tile-deep-raised: #383532;
  --toast-bg: #f4f1ec;
  --toast-ink: #16130f;
  --focus: #f4f1ec;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 12px 30px -14px rgb(0 0 0 / 0.7);
  --shadow-3: 0 26px 70px -20px rgb(0 0 0 / 0.85);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color var(--mid) var(--ease), color var(--mid) var(--ease);
}

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

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

ul {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.sprite {
  position: absolute;
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon .dot,
symbol .dot {
  fill: currentColor;
  stroke: none;
}

.icon--sm {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.icon--lg {
  width: 30px;
  height: 30px;
}

.icon--xl {
  width: 56px;
  height: 56px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--ink-2);
}

.skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

html.intro [data-rise] {
  visibility: hidden;
}

/* ---------- Barre du haut ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 12px calc(var(--gutter) + env(safe-area-inset-left));
}

.topbar__end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand,
.status,
.icon-btn {
  height: 48px;
  background: var(--surface);
  border-radius: 24px;
  transition: transform var(--spring-t) var(--spring), border-radius var(--fast) var(--ease), background-color var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
}


.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 0 14px;
  text-decoration: none;
}

.brand:hover {
  transform: scale(1.03);
}

.brand:active {
  transform: scale(0.97);
  border-radius: 14px;
}

/* La marque reste blanche dans les deux thèmes ; en clair, un disque foncé la porte. */
.brand__mark {
  box-sizing: content-box;
  width: calc(34px - 2 * var(--brand-pad));
  height: calc(34px - 2 * var(--brand-pad));
  padding: var(--brand-pad);
  margin-left: -4px;
  border-radius: 50%;
  background: var(--brand-disc);
  transition: transform var(--spring-t) var(--spring-bouncy), background-color var(--mid) var(--ease);
}

.brand:hover .brand__mark {
  transform: rotate(-12deg);
}

.brand__body {
  fill: #f6f3ef;
}

.brand__arrow {
  fill: var(--accent);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity var(--mid) var(--ease), scale var(--spring-t) var(--spring), display var(--mid) allow-discrete;
}

/* La pastille ne se montre que lorsque la connexion pose problème. */
.status:is([data-status="online"], [data-status="connecting"], [data-status="idle"]) {
  display: none;
  opacity: 0;
  scale: 0.9;
}

@starting-style {
  .status {
    opacity: 0;
    scale: 0.9;
  }
}

.status__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
  transition: background-color var(--mid) var(--ease);
}

.status[data-status="online"] .status__dot {
  background: var(--success);
}

.status[data-status="closed"] .status__dot {
  background: var(--danger);
}

.status:is([data-status="connecting"], [data-status="reconnecting"], [data-status="idle"]) .status__dot {
  animation: breathe 1.2s var(--ease) infinite alternate;
}

@keyframes breathe {
  to {
    transform: scale(0.55);
    opacity: 0.5;
  }
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  flex: none;
}

.icon-btn:hover {
  transform: scale(1.08);
}

.icon-btn:active {
  transform: scale(0.94);
  border-radius: 14px;
}

.theme-icon {
  grid-area: 1 / 1;
  transition: transform var(--spring-t) var(--spring-bouncy), opacity var(--fast) var(--ease);
}

.theme-icon--moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.4);
}

:root[data-theme="dark"] .theme-icon--sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

:root[data-theme="dark"] .theme-icon--moon {
  opacity: 1;
  transform: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon--sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.4);
  }

  :root:not([data-theme="light"]) .theme-icon--moon {
    opacity: 1;
    transform: none;
  }
}

.bell-icon {
  grid-area: 1 / 1;
  transition: transform var(--spring-t) var(--spring-bouncy), opacity var(--fast) var(--ease);
}

.bell-icon--on,
[aria-pressed="true"] > .bell-icon--off {
  opacity: 0;
  transform: scale(0.4);
}

[aria-pressed="true"] > .bell-icon--on {
  opacity: 1;
  transform: none;
  transform-origin: 50% 12%;
}

.icon-btn[data-rang] > .bell-icon--on {
  animation: bell-ring 0.7s var(--ease);
}

@keyframes bell-ring {
  20% {
    transform: rotate(16deg);
  }

  45% {
    transform: rotate(-12deg);
  }

  70% {
    transform: rotate(6deg);
  }
}

/* ---------- Structure ---------- */

.stage {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 4px calc(var(--gutter) + env(safe-area-inset-right)) 16px calc(var(--gutter) + env(safe-area-inset-left));
}

.display,
.headline,
.card__title,
.dialog__title {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.display {
  font-weight: 800;
  font-size: clamp(36px, 4.8vw, 60px);
  line-height: 1.02;
}

.headline {
  font-weight: 800;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.05;
}

.headline--tight {
  font-size: clamp(22px, 3vw, 28px);
  overflow-wrap: anywhere;
}

.headline--small {
  font-size: 24px;
}

.lede {
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.4;
  max-width: 36ch;
  text-wrap: balance;
}

.lede--small {
  font-size: 16px;
  max-width: 46ch;
}

/* ---------- Boutons ---------- */

.btn {
  --btn-h: 56px;
  --btn-bg: var(--tonal);
  --btn-ink: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-h);
  padding: 0 26px;
  border-radius: calc(var(--btn-h) / 2);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--spring-t) var(--spring), border-radius var(--fast) var(--ease), background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: scale(0.97);
  border-radius: 16px;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn .icon {
  transition: transform var(--spring-t) var(--spring-bouncy);
}

.btn:hover .icon {
  transform: translateY(-2px) scale(1.08);
}

.btn--primary {
  --btn-bg: var(--accent);
  --btn-ink: var(--accent-ink);
}

.btn--primary:hover {
  --btn-bg: var(--accent-strong);
}

.btn--ghost {
  --btn-bg: var(--tonal);
}

.btn--quiet {
  --btn-bg: transparent;
  padding: 0 20px;
}

.btn--quiet:hover {
  --btn-bg: var(--tonal);
  transform: none;
}

.btn--sm {
  --btn-h: 44px;
  padding: 0 18px;
  font-size: 14.5px;
  gap: 8px;
}

.btn--sm:active {
  border-radius: 12px;
}

.btn--xl {
  --btn-h: 64px;
  padding: 0 32px;
  font-size: 18px;
}

.btn[data-done] {
  --btn-bg: var(--success-soft);
  --btn-ink: var(--success);
}

.link {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  padding: 12px 0;
}

.link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--mid) var(--ease);
}

.link:hover::after {
  transform: scaleX(1);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px 0 16px;
  border-radius: 24px;
  background: var(--surface);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  justify-self: start;
  align-self: flex-start;
  transition: transform var(--spring-t) var(--spring), border-radius var(--fast) var(--ease);
}

.back .icon {
  transition: transform var(--spring-t) var(--spring-bouncy);
}

.back:hover .icon {
  transform: translateX(-4px);
}

.back:active {
  transform: scale(0.97);
  border-radius: 14px;
}

/* ---------- Tuiles ---------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--surface);
  min-width: 0;
  transition: background-color var(--mid) var(--ease);
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card__title {
  font-weight: 700;
  font-size: 22px;
}

.card__meta {
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
}

.empty {
  color: var(--ink-2);
  font-size: 15px;
}

.field-note {
  font-size: 14.5px;
  color: var(--ink-2);
  min-height: 1.45em;
}

.field-note:empty {
  display: none;
}

.field-note[data-tone="error"] {
  color: var(--danger);
  font-weight: 700;
}

.avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  background: var(--tonal);
  color: var(--ink);
  transition: transform var(--spring-t) var(--spring-bouncy), border-radius var(--mid) var(--ease);
}

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

.home {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: min(620px, calc(100dvh - 190px));
}

.home__side {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  min-width: 0;
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 460px;
  min-width: 0;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  container: drop / inline-size;
}

.hero[data-state="prep"] {
  cursor: progress;
}

.hero__inner {
  flex: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 28px 36px 36px;
  text-align: center;
}

.orb {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 1;
}

.orb__ring {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  transition: border-color var(--mid) var(--ease);
}

.orb__ring--in {
  inset: 24%;
}

.hero:is([data-state="drag"], [data-state="prep"]) .orb__ring {
  border-color: var(--accent);
}

.orb__chip {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: var(--tonal);
  color: var(--ink);
  will-change: transform;
  transition: background-color var(--mid) var(--ease), color var(--mid) var(--ease);
}

.orb__chip .icon {
  width: 21px;
  height: 21px;
}

.hero[data-state="drag"] .orb__chip {
  background: var(--ink);
  color: var(--surface);
}

/* Centré par ses bords, sans translate : l'animation de dépôt (scale) ne peut plus le décaler. */
.orb__hub {
  position: absolute;
  inset: 36.5%;
}

.orb__core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  transition: scale var(--spring-t) var(--spring), background-color var(--mid) var(--ease), color var(--mid) var(--ease);
}

.orb__core > * {
  place-self: center;
}

.orb__core .icon {
  width: 34px;
  height: 34px;
}

.hero[data-state="idle"]:hover .orb__core {
  scale: 1.05;
}

.hero:not([data-state="idle"]) .orb__core {
  background: var(--accent);
  color: var(--accent-ink);
}

.hero[data-state="drag"] .orb__core {
  scale: 1.08;
}

.hero[data-state="drag"] .orb__core .icon {
  animation: orb-bob 0.8s var(--ease) infinite;
}

@keyframes orb-bob {
  50% {
    translate: 0 4px;
  }
}

/* Les libellés de chaque état partagent la même cellule : le changement ne décale rien. */
.hero .swap {
  display: grid;
}

.hero .swap > * {
  grid-area: 1 / 1;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  translate: 0 0.4em;
  transition: opacity 0.14s var(--ease), translate 0.14s var(--ease), visibility 0s 0.14s;
}

.hero[data-state="idle"] .swap > [data-when~="idle"],
.hero[data-state="drag"] .swap > [data-when~="drag"],
.hero[data-state="drop"] .swap > [data-when~="drop"],
.hero[data-state="prep"] .swap > [data-when~="prep"] {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition: opacity 0.22s var(--ease) 0.08s, translate var(--spring-t) var(--spring) 0.08s, visibility 0s 0.08s;
}

.hero__body {
  display: grid;
  justify-items: center;
  width: 100%;
  min-width: 0;
}

.hero__title {
  width: 100%;
}

.hero__title > * {
  align-self: center;
}

.hero .display {
  margin: 0;
  font-size: min(60px, max(34px, calc((100cqi - 72px) / 10.8)));
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero__note {
  min-height: 28px;
  margin: 12px 0 0;
  color: var(--ink-2);
}

.hero__note > * {
  align-self: center;
}

.hero__note .mono {
  font-size: 17px;
  color: var(--accent-text);
}

.hero__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 24px;
}

.hero__actions .btn {
  width: 100%;
}

.hero .btn--ghost {
  --btn-bg: var(--tonal);
  --btn-ink: var(--ink);
}

.hero__prep {
  display: grid;
  gap: 10px;
  width: min(360px, 100%);
  margin-top: 22px;
}

.hero__prep .wavy__track {
  stroke: var(--tonal);
}

.hero__prep .mono {
  min-height: 1.45em;
  color: var(--ink-2);
}

@container drop (min-width: 700px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    justify-items: stretch;
    gap: 28px;
    padding: 32px 44px 32px 28px;
    text-align: start;
  }

  .orb {
    width: min(100%, 380px);
    justify-self: center;
  }

  .hero__body {
    justify-items: start;
  }

  .hero .display {
    font-size: min(52px, calc((50cqi - 64px) / 5.4));
  }

  .hero__actions {
    grid-template-columns: 1fr 1fr;
  }

  .hero__actions .btn--primary {
    grid-column: 1 / -1;
  }
}

@container drop (max-width: 440px) {
  .hero__actions {
    grid-template-columns: 1fr 1fr;
  }

  .hero__actions .btn--primary {
    grid-column: 1 / -1;
  }

  .orb {
    width: min(100%, 270px);
  }

  .orb__chip {
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
  }

  .orb__chip .icon {
    width: 19px;
    height: 19px;
  }

  .orb__core .icon {
    width: 28px;
    height: 28px;
  }
}

/* Sans sélection de dossier (mobile), les deux boutons restants partagent la ligne. */
.hero__actions:has(> [hidden]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero__actions:has(> [hidden]) .btn--primary {
  grid-column: auto;
}

.hero__outline {
  position: absolute;
  inset: 5px;
  z-index: -1;
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  overflow: visible;
  pointer-events: none;
}

.hero__outline rect {
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 10 10;
  animation: outline-march 1.6s linear infinite;
  transition: stroke var(--mid) var(--ease);
}

.hero[data-state="idle"]:hover .hero__outline rect {
  stroke: var(--ink-3);
  animation-duration: 1s;
}

.hero:is([data-state="drag"], [data-state="prep"]) .hero__outline rect {
  stroke: var(--accent);
  animation-duration: 0.6s;
}

@keyframes outline-march {
  to {
    stroke-dashoffset: -40;
  }
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  margin: 0 2px;
  border-radius: 8px;
  background: var(--tonal);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  vertical-align: 1px;
}

.code-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.4vw, 8px);
}

.code-input__slot {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 72px;
  aspect-ratio: 1;
  transition: transform var(--spring-t) var(--spring);
}

.code-input__slot:focus-within {
  z-index: 1;
  transform: scale(1.05);
}

.code-input__cell {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--bg);
  color: transparent;
  caret-color: transparent;
  text-align: center;
  font-size: 16px;
  outline: none;
  transition: border-radius var(--spring-t) var(--spring), background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.code-input__cell::selection {
  background: transparent;
  color: transparent;
}

.code-input__cell[data-filled] {
  background: var(--accent-soft);
}

.code-input__cell:hover {
  border-radius: 38%;
}

.code-input__cell:focus {
  border-radius: 32%;
  background: var(--surface);
  box-shadow: inset 0 0 0 3px var(--accent);
}

.code-input__digit {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(20px, 5vw, 28px);
  pointer-events: none;
}

/* Tiret d'attente rendu dans la grille du chiffre : centré au pixel, contrairement à un placeholder. */
.code-input__slot:not(:focus-within) .code-input__digit:empty::after {
  content: "–";
  color: color-mix(in srgb, var(--ink-3) 55%, transparent);
}

.code-input__slot:focus-within .code-input__digit:empty::after {
  content: "";
  width: 3px;
  height: 40%;
  border-radius: 2px;
  background: var(--accent);
  animation: caret 0.55s var(--ease) infinite alternate;
}

@keyframes caret {
  to {
    opacity: 0;
  }
}

.code-input__sep {
  width: clamp(4px, 1.5vw, 12px);
  flex: none;
}

.code-input[data-state="error"] .code-input__cell {
  background: var(--danger-soft);
}

.code-input[data-state="error"] .code-input__digit {
  color: var(--danger);
}

.field-note[data-tone="busy"] {
  color: var(--ink);
}



/* Grille de trois colonnes qui remplit la carte et défile verticalement à l'intérieur :
   avec beaucoup d'appareils, la tuile garde sa taille et la page ne défile pas. */
.peer-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px 8px;
  flex: 1 1 0;
  min-height: 150px;
  margin: -8px -4px;
  padding: 8px 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.peer-list > li {
  min-width: 0;
  scroll-snap-align: start;
}

/* En une colonne, la carte n'a plus de hauteur imposée : deux rangées, puis défilement. */
@media (max-width: 860px) {
  .peer-list {
    flex: none;
    max-height: 316px;
  }
}

.peer-list:empty {
  display: none;
}

.peer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px;
  border-radius: var(--r-md);
  text-align: center;
}

.peer .avatar {
  width: 76px;
  height: 76px;
  background: var(--ink);
  color: var(--bg);
}

.peer .avatar .icon {
  width: 30px;
  height: 30px;
}

.peer-list li:nth-child(3n + 2) .avatar {
  background: var(--tonal);
  color: var(--ink);
}

.peer-list li:nth-child(3n) .avatar {
  background: var(--accent);
  color: var(--accent-ink);
}

.peer:hover .avatar {
  transform: scale(1.08) rotate(-6deg);
  border-radius: 34%;
}

.peer:active .avatar {
  transform: scale(0.95);
  border-radius: 28%;
}

.peer__name {
  display: block;
  max-width: 100%;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.peer__meta {
  display: block;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-2);
  text-wrap: balance;
}

.me {
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: auto;
  font-size: 14.5px;
}

.me__name {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: var(--tonal);
  font-weight: 700;
  transition: transform var(--spring-t) var(--spring), border-radius var(--fast) var(--ease);
}

.me__name:hover {
  transform: scale(1.04);
}

.me__name:active {
  transform: scale(0.96);
  border-radius: 12px;
}

/* ---------- Partage ---------- */

.share {
  display: grid;
  gap: 16px;
}

.code-tile {
  --focus: #f6f3ef;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
  gap: 24px 32px;
  align-items: center;
  padding: 40px 44px;
  border-radius: var(--r-2xl);
  background: var(--tile-deep);
  color: var(--tile-deep-ink);
}

.code-tile .lede {
  margin-top: 6px;
  color: var(--tile-deep-muted);
}

.code-display {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.2vw, 10px);
  width: 100%;
  max-width: 620px;
  margin-top: 24px;
  border-radius: var(--r-xl);
}

.code-display__digit {
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  color: #16130f;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(22px, 5.4vw, 42px);
  transition: transform var(--spring-t) var(--spring-bouncy), border-radius var(--mid) var(--ease);
  transition-delay: calc(var(--i) * 25ms);
}

.code-display:not(:disabled):hover .code-display__digit {
  transform: translateY(-6px);
}

.code-display:not(:disabled):active .code-display__digit {
  transform: scale(0.94);
  border-radius: 32%;
}

.code-display--placeholder .code-display__digit {
  color: #6b635b;
  animation: breathe 0.9s var(--ease) calc(var(--i) * 90ms) infinite alternate;
}

.code-display__sep {
  width: clamp(4px, 1.6vw, 14px);
  flex: none;
}

.share__actions {
  display: grid;
  gap: 10px;
}

.share__actions .btn {
  width: 100%;
}


.code-tile .btn--ghost {
  --btn-bg: var(--tile-deep-raised);
  --btn-ink: var(--tile-deep-ink);
}

.code-tile .btn[data-done] {
  --btn-bg: #d5f0df;
  --btn-ink: #156b40;
}

.share__side {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.share__stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.qr-card {
  align-items: center;
  text-align: center;
  padding: 24px;
}

.qr {
  width: 100%;
  max-width: 184px;
  aspect-ratio: 1;
  padding: 14px;
  border-radius: var(--r-lg);
  background: #fff;
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-card__text {
  font-size: 14.5px;
  color: var(--ink-2);
}

.qr-card__url {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.file-list {
  display: grid;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.file-list:has(> .file-tree) {
  max-height: none;
  overflow: visible;
}

.file-tree .tree__body {
  max-height: 360px;
  background: var(--bg);
}

.file-tree .tree__btn,
.file-tree .file__btn {
  flex: none;
}

.file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  min-width: 0;
}

.file__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--bg);
  overflow: hidden;
}

.file__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file__body {
  min-width: 0;
  flex: 1;
}

.file__name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file__meta {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: -0.02em;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file__actions {
  display: flex;
  gap: 6px;
}

.file--danger .file__icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.file-more {
  padding: 8px 0;
  font-size: 14px;
  color: var(--ink-2);
}

.message {
  padding: 16px 20px;
  border-radius: var(--r-md);
  background: var(--bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 240px;
  overflow-y: auto;
}

.message a {
  color: var(--accent-text);
  font-weight: 700;
}

.message--large {
  padding: 24px 28px;
  border-radius: var(--r-xl);
  background: var(--surface);
  font-size: 18px;
  max-height: none;
}

.message__tools {
  margin-top: 16px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  max-height: 232px;
  margin: -4px;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chip-list > li[hidden] {
  display: none;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search .icon {
  position: absolute;
  left: 18px;
  width: 20px;
  height: 20px;
  color: var(--ink-3);
  pointer-events: none;
  transition: color var(--fast) var(--ease), transform var(--spring-t) var(--spring-bouncy);
}

.search input {
  width: 100%;
  min-height: 52px;
  padding: 0 20px 0 50px;
  border: 0;
  border-radius: 26px;
  background: var(--bg);
  font-weight: 600;
  outline: none;
  transition: box-shadow var(--fast) var(--ease), border-radius var(--spring-t) var(--spring);
}

.search input::placeholder {
  color: var(--ink-3);
}

.search input:focus-visible {
  box-shadow: inset 0 0 0 3px var(--accent);
  border-radius: var(--r-md);
}

.search:focus-within .icon {
  color: var(--accent-text);
  transform: scale(1.1) rotate(-8deg);
}

.search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 4px 18px 4px 4px;
  border-radius: 26px;
  background: var(--bg);
  font-weight: 700;
  transition: transform var(--spring-t) var(--spring), border-radius var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.chip .avatar {
  width: 44px;
  height: 44px;
}

.chip:hover {
  transform: translateY(-2px);
}

.chip:active {
  transform: scale(0.96);
  border-radius: 14px;
}

.chip[data-sent] {
  background: var(--success-soft);
  color: var(--success);
  cursor: default;
}

.chip[data-sent] .avatar {
  background: var(--success);
  color: var(--success-soft);
}

.chip:disabled {
  transform: none;
}

.recipient-list {
  display: grid;
  gap: 18px;
}

.recipient-list:empty {
  display: none;
}

.recipient {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
}

.recipient__name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient__status {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: -0.02em;
  color: var(--ink-2);
  min-height: 1.45em;
}

.recipient[data-state="done"] .recipient__status {
  color: var(--success);
}

.recipient[data-state="done"] .avatar {
  background: var(--success-soft);
  color: var(--success);
}

.recipient[data-state="closed"] .avatar {
  background: var(--tonal);
  color: var(--ink-3);
}

.recipient__cancel {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform var(--spring-t) var(--spring-bouncy), border-radius var(--fast) var(--ease), background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.recipient__cancel:hover {
  transform: rotate(90deg);
  background: var(--danger-soft);
  color: var(--danger);
}

.recipient__cancel:active {
  border-radius: 30%;
}

.wavy {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: 16px;
  overflow: visible;
}

.wavy path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}

.wavy__track {
  stroke: var(--tonal);
}

.wavy__fill {
  stroke: var(--accent);
  transition: stroke var(--mid) var(--ease);
}

.recipient[data-state="done"] .wavy__fill {
  stroke: var(--success);
}

.recipient[data-state="closed"] .wavy__fill {
  stroke: var(--ink-3);
}

.waiting-dots {
  display: inline-flex;
  gap: 5px;
  margin-right: 8px;
}

.waiting-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: hop 0.6s var(--ease) infinite alternate;
}

.waiting-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.waiting-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes hop {
  to {
    transform: translateY(-5px);
    opacity: 0.45;
  }
}

/* ---------- Demande d'accord ---------- */

.waiting {
  justify-items: center;
  text-align: center;
}

.waiting__beacon {
  position: relative;
  display: grid;
  place-items: center;
  width: 136px;
  height: 136px;
  margin-top: 4px;
}

.waiting__beacon .avatar {
  position: relative;
  z-index: 1;
  width: 76px;
  height: 76px;
  background: var(--ink);
  color: var(--surface);
  animation: waiting-breathe 2.4s ease-in-out infinite;
}

.waiting__beacon .avatar .icon {
  width: 32px;
  height: 32px;
}

.waiting__wave {
  position: absolute;
  inset: 30px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: waiting-wave 2.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.waiting__wave:nth-child(2) {
  animation-delay: 0.8s;
}

.waiting__wave:nth-child(3) {
  animation-delay: 1.6s;
}

@keyframes waiting-wave {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }

  100% {
    transform: scale(2);
    opacity: 0;
  }
}

@keyframes waiting-breathe {
  50% {
    transform: scale(1.05);
  }
}

.waiting__status {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: var(--ink-2);
}

.waiting__actions {
  justify-content: center;
  width: 100%;
  margin-left: 0;
}

.requests__head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.requests__badge {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  padding: 0 12px;
  border-radius: 24px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 19px;
}

.request-list {
  display: grid;
  gap: 8px;
  max-height: min(46dvh, 360px);
  margin: 0 -4px;
  padding: 0 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.request {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--bg);
}

.request__name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.request__what {
  font-size: 14px;
  color: var(--ink-2);
}

.request__actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 460px) {
  .request {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .request__actions {
    grid-column: 1 / -1;
  }

  .request__actions .btn {
    flex: 1;
  }
}

/* ---------- Réception ---------- */

.receive {
  display: grid;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
}

.sender {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 6px;
  min-width: 0;
}

.sender .avatar {
  width: 56px;
  height: 56px;
  background: var(--ink);
  color: var(--bg);
}

.sender__label {
  font-size: 14px;
  color: var(--ink-2);
}

.sender--compact {
  padding: 0;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 600;
  font-size: 15px;
}

.notice[role="alert"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.progress-panel {
  --focus: #16130f;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  min-height: 320px;
  padding: 28px 32px;
  border-radius: var(--r-2xl);
  background: var(--liquid-bg);
  color: var(--liquid-ink);
  overflow: hidden;
  isolation: isolate;
}

.liquid {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.liquid__back {
  fill: var(--liquid-back);
}

.liquid__front {
  fill: var(--liquid-front);
}

.progress-panel__stats {
  display: grid;
  gap: 2px;
  font-size: 15px;
  font-weight: 500;
  min-height: 3em;
}

.progress-panel__stats > :first-child {
  font-size: 18px;
  font-weight: 600;
}

.progress-panel__pct {
  display: flex;
  align-items: baseline;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(84px, 24vw, 128px);
  line-height: 1;
  letter-spacing: -0.08em;
}

.progress-panel__pct small {
  font-size: 0.36em;
  letter-spacing: 0;
  margin-left: 0.3em;
}

.progress-panel__foot {
  display: grid;
  gap: 10px;
}

.progress-panel__foot .mono {
  font-size: 14.5px;
  font-weight: 500;
}

.progress-panel .field-note {
  color: var(--liquid-ink);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: #ffffff;
}

.done {
  --focus: #f6f3ef;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px 20px;
  padding: 28px 32px;
  border-radius: var(--r-2xl);
  color: var(--tile-deep-ink);
  isolation: isolate;
}

.done__bg {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  border-radius: var(--r-2xl);
  background: var(--tile-deep);
}

.done .muted {
  color: var(--tile-deep-muted);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.done__check {
  width: 64px;
  height: 64px;
  flex: none;
}

.done__check circle {
  fill: var(--accent);
}

.done__check path {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.done__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.done__actions:empty {
  display: none;
}

.saved-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--tile-deep-raised);
  color: var(--tile-deep-ink);
  font-weight: 600;
}

.saved-note .icon {
  color: var(--accent);
}


.done .btn--ghost {
  --btn-bg: var(--tile-deep-raised);
  --btn-ink: var(--tile-deep-ink);
}

.receive__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.receive__cta .btn--xl {
  flex: 1 1 240px;
}

/* ---------- Pied de page ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 calc(var(--gutter) + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
}

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

.stats > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--r-lg);
  background: var(--tonal);
  white-space: nowrap;
}

.stats dt {
  order: 2;
  font-size: 14px;
  color: var(--ink-2);
}

.stats dd {
  font-weight: 600;
  font-size: 17px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  font-size: 14px;
  color: var(--ink-2);
}

/* ---------- Dialogues ---------- */

.dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: min(86dvh, 720px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overflow: auto;
  opacity: 0;
  transform: translateY(24px) scale(0.94);
  transition: opacity var(--fast) var(--ease), transform var(--mid) var(--ease), overlay var(--mid) allow-discrete, display var(--mid) allow-discrete;
}

.dialog[open] {
  opacity: 1;
  transform: none;
  transition: opacity var(--mid) var(--ease), transform var(--spring-t) var(--spring), overlay var(--slow) allow-discrete, display var(--slow) allow-discrete;
}

@starting-style {
  .dialog[open] {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
  }
}

.dialog::backdrop {
  background: rgb(10 9 8 / 0);
  transition: background-color var(--mid) var(--ease), overlay var(--mid) allow-discrete, display var(--mid) allow-discrete;
}

.dialog[open]::backdrop {
  background: rgb(10 9 8 / 0.55);
}

@starting-style {
  .dialog[open]::backdrop {
    background: rgb(10 9 8 / 0);
  }
}

.dialog--wide {
  width: min(640px, calc(100vw - 32px));
}

.dialog__body {
  display: grid;
  gap: 16px;
  padding: 32px;
}

.dialog__title {
  font-weight: 700;
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dialog__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.input,
.textarea {
  width: 100%;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--bg);
  padding: 16px 22px;
  font-weight: 600;
  outline: none;
  transition: box-shadow var(--fast) var(--ease), border-radius var(--spring-t) var(--spring);
}

.input {
  min-height: 56px;
}

.textarea {
  border-radius: var(--r-md);
  font-weight: 500;
  resize: vertical;
  min-height: 140px;
}

:is(.input, .textarea):focus-visible {
  box-shadow: inset 0 0 0 3px var(--accent);
  border-radius: var(--r-md);
}

:is(.input, .textarea)::placeholder {
  color: var(--ink-3);
}

.prose {
  gap: 10px;
}

.prose h3 {
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

.prose p {
  color: var(--ink-2);
  font-size: 15.5px;
}

.prose a {
  color: var(--accent-text);
  font-weight: 700;
}

.prose .dialog__actions {
  margin-top: 12px;
}

/* ---------- Dépôt et notifications ---------- */

.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  visibility: hidden;
}

.drop-veil .liquid {
  z-index: 0;
}


.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(440px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 14px 22px 14px 16px;
  border-radius: 28px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
}

.toast[data-tone="success"] .icon {
  color: #2fae6b;
}

.toast[data-tone="error"] .icon {
  color: #f0563f;
}

/* ---------- Écrans étroits ---------- */

@media (max-width: 1040px) {
  .share__side {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .qr-card {
    grid-column: 1 / -1;
    flex-direction: row;
    text-align: left;
    gap: 20px;
  }

  .qr {
    max-width: 132px;
  }
}

@media (max-width: 860px) {
  .home,
  .share__side {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    min-height: 0;
    border-radius: var(--r-xl);
  }

  .hero__inner {
    gap: 10px;
    padding: 22px 22px 26px;
  }

  .hero__actions {
    gap: 8px;
    margin-top: 20px;
  }

  .hero__outline rect {
    rx: 31px;
    ry: 31px;
  }

  .code-tile {
    grid-template-columns: minmax(0, 1fr);
    padding: 28px 20px 20px;
    border-radius: var(--r-xl);
  }

  .card {
    padding: 24px 20px;
  }

  .progress-panel,
  .done {
    padding: 24px;
    border-radius: var(--r-xl);
  }

  .done__bg {
    border-radius: var(--r-xl);
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .dialog,
  .dialog--wide {
    width: 100vw;
    max-width: none;
    max-height: 90dvh;
    margin: auto 0 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
    transition: transform var(--mid) var(--ease), overlay var(--mid) allow-discrete, display var(--mid) allow-discrete;
    opacity: 1;
  }

  .dialog[open] {
    transition: transform var(--slow) var(--ease), overlay var(--slow) allow-discrete, display var(--slow) allow-discrete;
  }

  @starting-style {
    .dialog[open] {
      opacity: 1;
      transform: translateY(100%);
    }
  }

  .dialog__body {
    padding: 28px 20px calc(20px + env(safe-area-inset-bottom));
  }

  .dialog__actions {
    width: 100%;
  }

  .dialog__actions .btn {
    flex: 1 1 auto;
  }

  .stats {
    width: 100%;
  }

  .stats > div {
    flex: 1 1 auto;
    padding: 10px 16px;
  }
}

@media (max-width: 420px) {
  .status {
    gap: 7px;
    padding: 0 14px;
    font-size: 13px;
  }

  .peer .avatar {
    width: 64px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 120ms !important;
    transition-delay: 0s !important;
    transition-timing-function: ease-out !important;
    transition-property: opacity, background-color, color, box-shadow !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---------- Réglages du partage ---------- */

.choice {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 28px;
  background: var(--bg);
}

.choice__option {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 6px 10px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}

.choice__option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice__option:has(input:checked) {
  color: var(--bg);
}

.choice__option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choice__thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 24px;
  background: var(--ink);
  transition: transform var(--spring-t) var(--spring), border-radius var(--fast) var(--ease);
}

.choice:has(.choice__option:nth-child(2) input:checked) .choice__thumb {
  transform: translateX(100%);
}

.choice:active .choice__thumb {
  border-radius: 14px;
}

.visibility {
  margin-top: auto;
}

.visibility__text {
  display: grid;
  gap: 2px;
}

.visibility__left {
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-3);
}

.chip__where {
  font-weight: 500;
  font-size: 12.5px;
  color: var(--ink-3);
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  font-weight: 600;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch__track {
  display: flex;
  align-items: center;
  width: 60px;
  height: 36px;
  flex: none;
  padding: 4px;
  border-radius: 18px;
  background: var(--line-strong);
  transition: background-color var(--mid) var(--ease);
}

.switch__thumb {
  width: 20px;
  height: 20px;
  margin: 4px;
  border-radius: 50%;
  background: var(--surface);
  transition: transform var(--spring-t) var(--spring-bouncy), background-color var(--mid) var(--ease);
}

.switch__text {
  display: grid;
  gap: 2px;
}

.switch__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.switch__hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.switch:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--tonal);
  font-size: 13px;
  font-weight: 600;
  animation: badge-in var(--mid) var(--ease) both;
}

@keyframes badge-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}

.switch:active .switch__thumb {
  transform: scale(1.3);
}

.switch input:checked + .switch__track {
  background: var(--accent);
}

.switch input:checked + .switch__track .switch__thumb {
  transform: translateX(24px) scale(1.4);
  background: var(--accent-ink);
}

.switch input:focus-visible + .switch__track {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.recipient__review {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.recipient[data-state="awaiting"] .wavy {
  display: none;
}

.receive-card .btn {
  align-self: flex-start;
}

/* ---------- Bascule de thème ---------- */

.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
  .hero .orb__core .icon,
  .hero .hero__outline rect,
  .waiting__wave,
  .waiting__beacon .avatar {
    animation: none;
  }
}
