/* Miroir — SOUL MATRIX · interface v2 (DA : espace sombre, verre, traits cyan 1 px, nacre irisée). */

@font-face {
  font-family: 'Abel';
  src: url('../fonts/Abel-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #05060A;
  --cyan: #7FE3E6;
  --lav: #B9A4FF;
  --water: #6FD3A5;
  --amber: #E9B872;
  --pink: #FF8AD8;
  --text: #F2F4F7;
  --text-2: #AEB6C4;
  --text-3: #737B8A;
  --cyan-50: rgba(127, 227, 230, 0.5);
  --cyan-35: rgba(127, 227, 230, 0.35);
  --cyan-18: rgba(127, 227, 230, 0.18);
  --cyan-10: rgba(127, 227, 230, 0.10);
  --glass: rgba(16, 19, 30, 0.55);
  --glass-hi: rgba(255, 255, 255, 0.06);
  --nacre: linear-gradient(120deg, #EDE6FF 0%, #CDF5F6 34%, #FFE1F3 64%, #E4F0FF 100%);
  --nacre-conic: conic-gradient(from 0deg, #7FE3E6, #B9A4FF, #FF8AD8, #FFE7A8, #7FE3E6, #B9A4FF, #7FE3E6);
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --gutter: 16px;
  --lens: 54px;
  --shutter: 84px;
  /* écrits par ui.js : centre / rayon du miroir et haut de la légende (px) */
  --cx: 50vw; --cy: 40vh; --r: 160px; --cap-top: 70vh;
}

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

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Abel', 'Avenir Next', 'Helvetica Neue', system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}

button, a { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
svg { display: block; }
ul { list-style: none; margin: 0; padding: 0; }

#gl {
  position: fixed;
  left: 0; top: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: var(--bg);
}

/* ---------- Calque d'interface : laisse passer les doigts vers le canvas ---------- */
.ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3; /* au-dessus du canvas de la mascotte (1) et de ses bulles (2) */
}
.ui button, .ui a, .ui .sheet, .ui .toast, .ui .scrim { pointer-events: auto; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: calc(var(--sat) + 6px) calc(var(--sar) + 10px) 0 calc(var(--sal) + var(--gutter));
  height: calc(var(--sat) + 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
  animation: fade-down 700ms var(--ease) both;
}
.wordmark {
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 11px;
  color: var(--text-2);
  padding-left: 2px;
}
.wordmark::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  vertical-align: 2px;
}
.top-actions { display: flex; gap: 2px; transition: opacity 400ms var(--ease); }
.is-home .top-actions { opacity: 0; visibility: hidden; }

.icon-btn {
  position: relative;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  border-radius: 50%;
  transition: transform 200ms var(--ease), opacity 300ms;
}
.icon-btn::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px solid var(--cyan-35);
  background: var(--glass);
}
.icon-btn svg { position: relative; width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.9); }
.icon-btn[aria-pressed="true"]::before { border-color: var(--cyan); box-shadow: 0 0 14px rgba(127, 227, 230, 0.25); }

.state-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: background 300ms, box-shadow 300ms;
}
[data-duo="waiting"] .state-dot, [data-duo="connecting"] .state-dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: pulse 1.6s ease-in-out infinite; }
[data-duo="connected"] .state-dot { background: var(--water); box-shadow: 0 0 8px var(--water); }
[data-duo="error"] .state-dot { background: #E98A8A; }

/* ---------- Panneaux du bas (accueil / commandes) ---------- */
.home, .controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0 calc(var(--sar) + 8px) calc(var(--sab) + 14px) calc(var(--sal) + 8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 500ms var(--ease), transform 500ms var(--ease), visibility 0s linear 500ms;
}
.is-home .home { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.is-main .home { opacity: 0; transform: translateY(16px); visibility: hidden; }
.is-home .controls, .is-home .caption { opacity: 0; transform: translateY(24px); visibility: hidden; }
.is-main .controls, .is-main .caption { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.is-home .controls *, .is-home .caption *, .is-main .home * { pointer-events: none !important; }

/* ---------- Accueil ---------- */
.home { text-align: center; padding-bottom: calc(var(--sab) + 22px); }
.home-title {
  margin: 0;
  font-weight: 400;
  font-size: 46px;
  line-height: 1;
  letter-spacing: 0.2em;
  padding-left: 0.2em;
  background: var(--nacre);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(185, 164, 255, 0.35));
  animation: rise 800ms var(--ease) 120ms both;
}
.home-tagline {
  margin: 12px 0 18px;
  max-width: 320px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text-2);
  animation: rise 800ms var(--ease) 240ms both;
}
.home-fx {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 0 0 22px;
}
.home-fx li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text-2);
  animation: rise 700ms var(--ease) both;
}
.home-fx li:nth-child(1) { animation-delay: 320ms; }
.home-fx li:nth-child(2) { animation-delay: 400ms; }
.home-fx li:nth-child(3) { animation-delay: 480ms; }
.home-fx .orb {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--cyan);
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 55%), var(--glass);
  border: 1px solid var(--cyan-35);
  box-shadow: 0 0 18px rgba(127, 227, 230, 0.12);
  animation: float 4.2s ease-in-out infinite;
}
.home-fx li:nth-child(2) .orb { animation-delay: -1.4s; color: var(--lav); border-color: rgba(185, 164, 255, 0.4); }
.home-fx li:nth-child(3) .orb { animation-delay: -2.8s; color: var(--water); border-color: rgba(111, 211, 165, 0.4); }
.home-fx .orb svg { width: 26px; height: 26px; }

.cta {
  position: relative;
  isolation: isolate;
  min-height: 58px;
  min-width: 272px;
  padding: 0 34px;
  border-radius: 999px;
  color: #0B0D16;
  background: var(--nacre);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55) inset, 0 10px 34px rgba(185, 164, 255, 0.3);
  animation: rise 800ms var(--ease) 560ms both;
  transition: transform 200ms var(--ease);
}
.cta::before { /* halo nacré qui respire (le bouton lui-même reste immobile) */
  content: '';
  position: absolute;
  inset: -14px -10px;
  border-radius: 999px;
  background: radial-gradient(closest-side, rgba(185, 164, 255, 0.55), rgba(127, 227, 230, 0.3) 55%, rgba(127, 227, 230, 0) 100%);
  z-index: -2;
  animation: halo 3.2s ease-in-out 1.4s infinite;
}
.cta-sheen { /* reflet qui balaie la nacre */
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  z-index: -1;
}
.cta-sheen::after {
  content: '';
  position: absolute;
  top: -20%; bottom: -20%; left: 0;
  width: 40%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  transform: translateX(-160%) skewX(-18deg);
  animation: sheen 3.2s ease-in-out 1.6s infinite;
}
.cta:active { transform: scale(0.96); }
.cta:disabled { cursor: default; }
.cta-orbit {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid #3A3F63;
  position: relative;
  flex: none;
}
.cta-orbit::after {
  content: '';
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #3A3F63;
  top: 50%; left: 50%;
  margin: -2px 0 0 -2px;
}
.cta.is-loading .cta-orbit::after {
  top: -2.5px; left: 50%;
  margin: 0 0 0 -2px;
  transform-origin: 2px 9px;
  animation: orbit 1.1s linear infinite;
}
.home-note {
  margin: 18px 0 0;
  max-width: 320px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
  animation: rise 800ms var(--ease) 680ms both;
}
.home-note .muted { opacity: 0.8; }

/* ---------- Scène (au-dessus du miroir) ---------- */
.stage { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.touch-fx { position: absolute; inset: 0; }
.ripple, .hold {
  position: absolute;
  left: 0; top: 0;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}
.ripple {
  width: 140px; height: 140px;
  margin: -70px 0 0 -70px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0) 38%, rgba(127, 227, 230, 0.32) 58%, rgba(185, 164, 255, 0.18) 66%, rgba(255, 255, 255, 0) 72%);
  animation: ripple 620ms var(--ease) forwards;
}
.ripple.tap {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0, rgba(127, 227, 230, 0.35) 30%, rgba(185, 164, 255, 0) 70%);
  animation-duration: 480ms;
}
.hold {
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  background: radial-gradient(circle, rgba(127, 227, 230, 0.22), rgba(185, 164, 255, 0.10) 50%, rgba(0, 0, 0, 0) 70%);
  box-shadow: 0 0 0 1.5px rgba(242, 244, 247, 0.55), 0 0 18px rgba(127, 227, 230, 0.45);
  transition: opacity 220ms;
}

.coach {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  transform: translate(var(--fx, 50vw), var(--fy, 40vh));
  transition: transform 500ms var(--ease), opacity 400ms;
  animation: fade 600ms var(--ease) both;
}
.coach.is-out { opacity: 0; }
.coach-ring {
  position: absolute;
  width: 96px; height: 96px;
  left: -48px; top: -48px;
  border-radius: 50%;
  border: 2px solid rgba(242, 244, 247, 0.8);
  box-shadow: 0 0 18px rgba(127, 227, 230, 0.6), inset 0 0 18px rgba(127, 227, 230, 0.35);
  animation: coach-ring 1.8s var(--ease) infinite;
}
.coach-ring.r2 { animation-delay: 0.9s; }
.coach-finger {
  position: absolute;
  width: 58px; height: 58px;
  left: -14px; top: -6px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M17 26V9.5a3.5 3.5 0 0 1 7 0V21l.4-2.3a3.3 3.3 0 0 1 6.5.8V23l.5-1.5a3.2 3.2 0 0 1 6.2 1.2V26l.5-.9a3 3 0 0 1 5.6 1.6c0 7-1.7 12.1-4.6 15.1-1.6 1.6-3.8 2.2-6.1 2.2h-8.2c-2.6 0-5-1.2-6.6-3.3l-7.5-9.8a3.3 3.3 0 0 1 5-4.3z' fill='%23F2F4F7' stroke='%2305060A' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 10px rgba(127, 227, 230, 0.5));
  transform-origin: 30% 10%;
  animation: coach-press 1.8s var(--ease) infinite;
}
.coach-label {
  position: absolute;
  left: 50%; top: 62px;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(10, 12, 20, 0.72);
  border: 1px solid var(--cyan-35);
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.lens-name {
  position: absolute;
  left: var(--cx);
  top: calc(var(--cy) - var(--r) * 0.62);
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  text-shadow: 0 2px 14px rgba(5, 6, 10, 0.85), 0 0 2px rgba(5, 6, 10, 0.9);
}
.lens-name b { display: block; font-weight: 400; font-size: 13px; letter-spacing: 0.32em; padding-left: 0.32em; text-transform: uppercase; color: var(--cyan); }
.lens-name span { display: block; margin-top: 4px; font-size: 30px; letter-spacing: 0.08em; color: var(--text); }
.lens-name.is-on { animation: lens-name 1300ms var(--ease) both; }

/* ---------- Légende sous le miroir ---------- */
.caption {
  position: absolute;
  left: 0; right: 0;
  top: var(--cap-top);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 calc(var(--sar) + 12px) 0 calc(var(--sal) + 12px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease), visibility 0s linear 500ms;
}
.tip {
  position: relative;
  margin: 0;
  max-width: min(360px, 100%);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(10, 12, 20, 0.6);
  border: 1px solid var(--cyan-18);
  font-size: 15px;
  line-height: 1.3;
  color: var(--text);
  text-align: center;
  overflow: hidden;
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}
.tip::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin: 0 9px 2px 0;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 1.8s ease-in-out infinite;
}
.tip.is-out { opacity: 0; transform: translateY(6px) scale(0.97); }
.tip.is-live { border-color: var(--cyan-50); box-shadow: 0 0 18px rgba(127, 227, 230, 0.18); }
.tip-bar { position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; border-radius: 2px; background: rgba(127, 227, 230, 0.12); overflow: hidden; opacity: 0; transition: opacity 300ms; }
.tip-bar i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--cyan), var(--lav), var(--pink)); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.tip.has-progress .tip-bar { opacity: 1; }

.stickers { display: none; gap: 6px; align-items: center; }
.is-doodle .stickers { display: flex; animation: pop-in 380ms var(--spring) both; }
.is-doodle .tip { display: none; }
.tool {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink, #FF4D5E);
  background: rgba(10, 12, 20, 0.62);
  border: 1px solid var(--cyan-18);
  transition: transform 220ms var(--spring), border-color 200ms, box-shadow 200ms;
}
.tool svg { width: 28px; height: 28px; overflow: visible; }
.tool:active { transform: scale(0.88); }
.tool[aria-pressed="true"] {
  transform: scale(1.1);
  border-color: rgba(242, 244, 247, 0.85);
  box-shadow: 0 0 0 2px rgba(5, 6, 10, 0.6), 0 0 16px var(--ink, var(--cyan));
}
.tool.erase { color: var(--text-2); }
.tool.erase svg { width: 20px; height: 20px; }

/* ---------- Commandes ---------- */
.controls { gap: 8px; }
.row-top {
  width: 100%;
  min-height: 46px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.chips, .palette {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.chip {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  color: var(--text-2);
  background: rgba(16, 19, 30, 0.55);
  border: 1px solid var(--cyan-18);
  font-size: 15px;
  letter-spacing: 0.04em;
  transition: border-color 250ms, box-shadow 250ms, transform 220ms var(--spring);
}
.chip:active { transform: scale(0.94); }
.chip[aria-checked="true"] {
  color: #0B0D16;
  background: var(--nacre);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 22px rgba(127, 227, 230, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.chips.is-swap { animation: chips-swap 380ms var(--ease) both; }

.palette { display: none; gap: 3px; }
.is-doodle .palette { display: flex; animation: pop-in 380ms var(--spring) both; }
.is-doodle .chips { display: none; }
.swatch {
  width: 38px; height: 44px;
  display: grid;
  place-items: center;
}
.swatch span {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 220ms var(--spring), box-shadow 200ms;
}
.swatch[aria-pressed="true"] span {
  transform: scale(1.22);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 0 0 2.5px var(--bg), 0 0 0 4px var(--text), 0 0 14px var(--c);
}

/* Rangée des objectifs : 2 à gauche, déclencheur, 2 à droite */
.lens-row {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}
.lens {
  flex: 0 0 auto;
  width: calc(var(--lens) + 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: calc((var(--shutter) - var(--lens)) / 2);
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: 0.05em;
  transition: color 250ms;
}
.lens-orb {
  position: relative;
  width: var(--lens); height: var(--lens);
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 55%), rgba(16, 19, 30, 0.62);
  border: 1px solid var(--cyan-18);
  transition: transform 300ms var(--spring), color 250ms, border-color 250ms, box-shadow 250ms;
}
.lens-orb svg { width: 27px; height: 27px; }
.lens-orb::after { /* anneau nacré de l'objectif actif */
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--nacre-conic);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 300ms, transform 400ms var(--spring);
}
.lens-label { white-space: nowrap; line-height: 1; }
.lens:active .lens-orb { transform: scale(0.9); }
.lens[aria-selected="true"] { color: var(--text); }
.lens[aria-selected="true"] .lens-orb {
  color: var(--cyan);
  border-color: transparent;
  transform: scale(1.08);
  box-shadow: 0 0 22px rgba(127, 227, 230, 0.35);
}
.lens[aria-selected="true"] .lens-orb::after { opacity: 1; transform: none; animation: spin 7s linear infinite; }
.lens.doodle[aria-selected="true"] .lens-orb { color: var(--ink, #FF4D5E); box-shadow: 0 0 22px rgba(255, 138, 216, 0.35); }

/* ---------- Déclencheur nacré ---------- */
.shutter {
  position: relative;
  flex: none;
  width: var(--shutter); height: var(--shutter);
  border-radius: 50%;
  margin: 0 6px;
  transition: transform 220ms var(--spring);
  touch-action: none;
  -webkit-touch-callout: none;
}
.shutter-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--nacre-conic);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  animation: spin 9s linear infinite;
}
.shutter::before { /* halo */
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 164, 255, 0.28), rgba(127, 227, 230, 0.12) 55%, rgba(0, 0, 0, 0) 70%);
  animation: halo 3.6s ease-in-out infinite;
}
.shutter-orb {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95) 0, rgba(255, 255, 255, 0.55) 12%, rgba(255, 255, 255, 0) 36%),
    radial-gradient(circle at 70% 78%, rgba(255, 138, 216, 0.55), rgba(255, 138, 216, 0) 45%),
    conic-gradient(from 210deg, #CFC2FF, #A8EEF0, #FFD3EE, #FFF1C9, #C9E6FF, #CFC2FF);
  box-shadow: inset 0 -6px 14px rgba(70, 50, 140, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 4px 18px rgba(0, 0, 0, 0.35);
  transition: transform 260ms var(--spring), border-radius 260ms var(--ease);
}
.shutter-progress {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px); height: calc(100% + 6px);
  transform: rotate(-90deg);
  opacity: 0;
  overflow: visible;
}
.shutter-progress circle {
  fill: none;
  stroke: #FF4D5E;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 4px rgba(255, 77, 94, 0.8));
}
.shutter.is-pressed { transform: scale(0.92); }
.shutter.is-pressed .shutter-orb { transform: scale(0.9); }
.shutter.is-snap .shutter-orb { animation: snap 420ms var(--spring); }
.shutter.is-arming .shutter-orb { transform: scale(0.86); }
.is-recording .shutter { transform: scale(1.1); }
.is-recording .shutter-ring { opacity: 0.25; }
.is-recording .shutter-orb {
  transform: scale(0.5);
  border-radius: 28%;
  background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 40%), #FF4D5E;
}
.is-recording .shutter-progress { opacity: 1; }
.is-recording .shutter-progress circle { animation: rec-progress var(--rec-ms, 3000ms) linear forwards; }
.shutter:disabled { cursor: default; }

/* Enregistrement : on épure */
.is-recording .lens, .is-recording .row-top, .is-recording .top-actions { opacity: 0.25; pointer-events: none; }
.lens, .row-top { transition: opacity 300ms; }

/* ---------- Flash photo ---------- */
.flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--cx) var(--cy), #fff, rgba(235, 240, 255, 0.85) 60%, rgba(220, 230, 255, 0.7));
  opacity: 0;
  pointer-events: none;
}
.flash.is-on { animation: flash 520ms ease-out; }

/* ---------- Feuilles ---------- */
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 8, 0.62);
  animation: fade 400ms var(--ease) both;
}
.sheet {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 12px);
  width: min(440px, calc(100% - 20px - var(--sal) - var(--sar)));
  max-height: calc(100% - var(--sat) - var(--sab) - 24px);
  overflow: auto;
  transform: translateX(-50%);
  border-radius: 30px;
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, rgba(26, 30, 46, 0.92), rgba(12, 14, 22, 0.94));
  border: 1px solid var(--cyan-35);
  box-shadow: 0 0 40px rgba(127, 227, 230, 0.10), 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: sheet-in 520ms var(--spring) both;
  -webkit-user-select: text;
  z-index: 4;
}
.sheet.is-leaving { animation: sheet-out 280ms ease-in both; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-title {
  margin: 0;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 13px;
  color: var(--text);
}
.sheet-text { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.sheet-status { margin: 10px 0 0; min-height: 18px; font-size: 14px; color: var(--text-2); text-align: center; }
.sheet-status:empty { display: none; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill {
  flex: 1 1 0;
  min-width: 110px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.06em;
  background: radial-gradient(120% 140% at 30% 0%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 60%), rgba(255, 255, 255, 0.04);
  border: 1px solid var(--cyan-35);
  transition: transform 200ms var(--spring), border-color 300ms, opacity 300ms;
}
.pill.primary {
  color: #0B0D16;
  background: var(--nacre);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 26px rgba(185, 164, 255, 0.3);
}
.pill svg { width: 18px; height: 18px; color: var(--cyan); flex: none; }
.pill.primary svg { color: #2B2F55; }
.pill:active { transform: scale(0.96); }
.pill:disabled, .pill[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.sheet-capture { padding-top: 12px; }
.cap-preview {
  position: relative;
  width: 100%;
  max-width: calc((100vh - var(--sat) - var(--sab) - 230px) * 0.8);
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  background: #070910;
  box-shadow: 0 0 0 1px var(--cyan-18), 0 12px 40px rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  animation: develop 700ms var(--ease) both;
}
.cap-preview video { object-fit: contain !important; }
.cap-preview img, .cap-preview video { width: 100%; height: 100%; object-fit: cover; display: block; animation: fade 500ms var(--ease) both; }
.cap-preview .loader { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--cyan-18); border-top-color: var(--cyan); animation: spin 1s linear infinite; }

.duo-state { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; color: var(--text-2); position: relative; }
.duo-state .state-dot { position: static; flex: none; }
.sheet[data-duo="idle"] .duo-state .state-dot { background: var(--text-3); }
.duo-link code {
  display: block;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--cyan-18);
  background: rgba(0, 0, 0, 0.25);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--cyan);
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  top: calc(var(--sat) + 62px);
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: rgba(14, 16, 24, 0.9);
  border: 1px solid rgba(233, 184, 114, 0.45);
  box-shadow: 0 0 24px rgba(233, 184, 114, 0.10);
  animation: toast-in 450ms var(--ease) both;
  z-index: 5;
}
.toast[data-kind="info"] { border-color: var(--cyan-35); box-shadow: 0 0 24px rgba(127, 227, 230, 0.12); }
.toast.is-leaving { animation: toast-out 350ms ease-in both; }

.fps {
  position: absolute;
  left: calc(var(--sal) + 10px);
  top: calc(var(--sat) + 52px);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- Animations (transform / opacity) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

@keyframes sheen { 0% { transform: translateX(-160%) skewX(-18deg); } 55%, 100% { transform: translateX(360%) skewX(-18deg); } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes halo { 0%, 100% { opacity: 0.6; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes snap { 0% { transform: scale(1); } 30% { transform: scale(0.72); } 100% { transform: scale(1); } }
@keyframes rec-progress { to { stroke-dashoffset: 0; } }
@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
@keyframes ripple { from { opacity: 1; transform: translate(var(--x), var(--y)) scale(0.25); } to { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.35); } }
@keyframes coach-ring { 0% { opacity: 0; transform: scale(0.45); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes coach-press { 0%, 100% { transform: translate(10px, 14px) scale(1.06); } 35%, 60% { transform: translate(0, 0) scale(0.94); } }
@keyframes lens-name { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.92); } 18%, 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -64%) scale(1); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes chips-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes develop { from { opacity: 0; transform: scale(0.9) rotate(-2deg); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { opacity: 0; transform: translate(-50%, 40px) scale(0.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes sheet-out { to { opacity: 0; transform: translate(-50%, 24px); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- Petits écrans / bureau ---------- */
@media (max-width: 380px) {
  :root { --lens: 48px; --shutter: 76px; }
  .lens-row { gap: 2px; }
  .lens { font-size: 13px; width: calc(var(--lens) + 10px); }
  .chip { padding: 0 13px; font-size: 14px; }
  .swatch { width: 34px; }
  .swatch span { width: 24px; height: 24px; }
  .tool { width: 42px; height: 42px; }
  .home-title { font-size: 40px; }
  .home-fx { gap: 16px; }
}
@media (max-height: 680px) {
  :root { --shutter: 74px; --lens: 48px; }
  .home-tagline { margin: 8px 0 12px; font-size: 15px; }
  .home-fx { margin-bottom: 14px; }
  .home-note { margin-top: 12px; }
  .controls { gap: 4px; }
}
@media (hover: hover) and (pointer: fine) {
  .chip:hover, .lens:hover, .pill:hover { color: var(--text); }
  .chip[aria-checked="true"]:hover, .pill.primary:hover { color: #0B0D16; }
  .icon-btn:hover::before, .lens:hover .lens-orb, .tool:hover { border-color: var(--cyan); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .is-recording .shutter-progress circle { animation-duration: var(--rec-ms, 3000ms) !important; }
  .coach-ring, .coach-finger { animation: none !important; }
  .coach-ring { opacity: 0.8; }
  .cta.is-loading .cta-orbit::after { animation: none !important; }
}
