/* GabForge : bleu nuit et or (couleurs du logo), cartes ivoire */
:root {
  --velvet: #0C2140;        /* bleu nuit (surfaces) */
  --velvet-deep: #030E1E;   /* bleu nuit profond (fond, comme l'icône) */
  --seam: #1F3A62;          /* filets et bordures */
  --gold: #E3B55B;          /* or du logo : actions principales */
  --gold-deep: #B8862F;
  --ivory: #F3ECDD;
  --ivory-dim: #CFD6E2;
  --ink: #141A24;
  --rouge: #B8232F;         /* réservé aux couleurs rouges des cartes et aux alertes */
  --rouge-soft: #F09AA2;
  --mute: #A3B2C8;
  --serif: 'Gloock', 'Bodoni 72', Didot, Georgia, serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-card: 12px;
  --r-ctl: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ivory);
  background:
    radial-gradient(130% 70% at 50% -10%, #17345F 0%, transparent 65%) fixed,
    var(--velvet-deep);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body.is-performing { overflow: hidden; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ivory); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- Écrans ---------- */
.screen {
  display: none;
  max-width: 560px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 20px)
    calc(env(safe-area-inset-right, 0px) + 20px)
    calc(env(safe-area-inset-bottom, 0px) + 28px)
    calc(env(safe-area-inset-left, 0px) + 20px);
}
.screen.is-active { display: block; }
#screen-boot.is-active { display: grid; place-items: center; }

.brand {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 46px;
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-align: center;
  margin: 0 0 8px;
}
.brand-sm { font-size: 28px; text-align: left; margin: 0; }
.title { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; margin: 0; }
.lede { color: var(--mute); text-align: center; margin: 0 auto; max-width: 30ch; }
.hint { color: var(--mute); font-size: 14px; margin: 8px 0 0; }

.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; min-height: 44px; }
#screen-menu .bar { justify-content: space-between; }
.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 1px solid var(--seam); border-radius: 50%;
  background: rgba(0, 0, 0, .2); cursor: pointer;
}

/* ---------- Cartes (motif commun) ---------- */
.card-face, .card-back { border-radius: var(--r-card); box-shadow: 0 10px 24px rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .06) inset; }
.card-face { position: relative; background: var(--ivory); color: var(--ink); }
.card-back {
  position: relative;
  border: 5px solid var(--ivory);
  background-color: var(--rouge);
  background-image:
    repeating-linear-gradient(45deg, rgba(243, 236, 221, .2) 0 1.5px, transparent 1.5px 8px),
    repeating-linear-gradient(-45deg, rgba(243, 236, 221, .2) 0 1.5px, transparent 1.5px 8px);
}
.idx {
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--serif); font-size: 20px; line-height: 1;
}
.idx b { font-family: var(--sans); font-weight: 400; font-size: 16px; margin-top: 2px; }
.idx-tl { top: 9px; left: 10px; }
.idx-br { bottom: 9px; right: 10px; transform: rotate(180deg); }
.is-red .idx { color: var(--rouge); }

/* ---------- Accès ---------- */
.gate-head { padding-top: 12px; text-align: center; }
.gate-logo { display: block; width: min(220px, 56vw); height: auto; margin: 4px auto 14px; filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .5)); }
.boot-logo { width: 160px; height: auto; filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .5)); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fan { position: relative; height: 150px; margin: 8px auto 18px; width: 200px; }
.fan-card {
  position: absolute; left: 50%; top: 10px;
  width: 82px; aspect-ratio: 5 / 7; margin-left: -41px;
  transform-origin: 50% 120%;
}
.fan-card:nth-child(1) { transform: rotate(-16deg); }
.fan-card:nth-child(2) { transform: rotate(0deg) translateY(-6px); z-index: 2; }
.fan-card:nth-child(3) { transform: rotate(16deg); }
.fan-card .idx { font-size: 18px; }

.tabs {
  display: flex; gap: 4px;
  margin: 28px 0 22px; padding: 4px;
  background: rgba(0, 0, 0, .28); border-radius: 12px;
}
.tabs button {
  flex: 1; min-height: 42px; padding: 8px 4px; font-size: 14.5px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--mute); font-weight: 500; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--velvet); color: var(--gold); box-shadow: inset 0 0 0 1px var(--seam); }

.panel label { display: block; font-size: 14px; color: var(--mute); margin-bottom: 16px; }
.panel input, .paid input {
  display: block; width: 100%; margin-top: 6px;
  padding: 13px 14px;
  font: 16px var(--sans); color: var(--ivory);
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--seam); border-radius: var(--r-ctl);
}
.panel input:focus { outline: none; border-color: var(--ivory); }
.code-input { letter-spacing: .14em; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.price { font-size: 17px; margin: 0 0 18px; }
.price span, .price s { font-family: var(--serif); font-size: 30px; }
.price s { font-size: 20px; color: var(--mute); margin-right: 4px; }
.promo-row { display: flex; gap: 8px; margin-top: 6px; }
.promo-row input { margin-top: 0 !important; flex: 1; text-transform: uppercase; letter-spacing: .06em; }
.promo-info { margin: -8px 0 16px; color: var(--gold); }
.promo-info.is-error { color: var(--rouge-soft); }
.panel label small { color: var(--mute); font-size: 12px; }
#gate-back { margin-top: 18px; }
.trial-banner {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 10px 10px 10px 14px;
  border-radius: 12px; border: 1px solid var(--gold-deep); background: rgba(227, 181, 91, .1);
}
.trial-text { flex: 1; font-size: 14px; color: var(--ivory); }
.panel .hint { margin: -6px 0 18px; }

.btn {
  display: block; width: 100%;
  min-height: 50px; padding: 13px 18px;
  border: 1px solid transparent; border-radius: var(--r-ctl);
  font-weight: 600; font-size: 16px; cursor: pointer;
}
.btn-primary { background: linear-gradient(180deg, #F0C978, var(--gold)); color: #1B1406; }
.btn-primary:active { background: var(--gold-deep); }
.btn-ghost { background: transparent; border-color: var(--seam); color: var(--ivory); }
.btn:disabled { opacity: .6; cursor: default; }
.form-msg { min-height: 1.5em; margin: 12px 0 0; font-size: 14px; color: var(--rouge-soft); }
.form-msg.is-ok { color: var(--ivory-dim); }

/* ---------- Paiement ---------- */
.paid { padding-top: 18vh; text-align: center; }
.paid .title { font-size: 36px; margin-bottom: 10px; }
.paid #paid-box { margin-top: 28px; }
.code-display {
  margin: 10px 0 22px; padding: 16px;
  font-family: var(--sans); font-size: 26px; font-weight: 600; letter-spacing: .12em;
  background: var(--ivory); color: var(--ink); border-radius: var(--r-ctl);
  user-select: all;
}
#paid-later { margin-top: 24px; }

/* ---------- Menu : les effets posés sur le tapis ---------- */
.spread {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 18px;
  padding: 8px 4px 24px;
}
.mode {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  aspect-ratio: 5 / 7;
  padding: 34px 14px;
  text-align: center;
  border: 0;
  transition: transform .18s ease;
}
button.mode { cursor: pointer; }
.is-tilt-l { transform: rotate(-1.6deg); }
.is-tilt-r { transform: rotate(1.3deg); }
button.mode:active { transform: rotate(0) scale(.97); }
.mode-title { font-family: var(--serif); font-size: 22px; line-height: 1.1; }
.mode-desc { margin-top: 10px; font-size: 13px; line-height: 1.35; color: #54607A; }
.mode.is-soon { padding: 12px; }
.soon-banner {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--ivory); color: var(--ink);
}
.soon-title { font-family: var(--serif); font-size: 16px; line-height: 1.15; }
.soon-banner small { font-size: 12px; color: #66718A; }

/* ---------- Réglages ---------- */
.help {
  margin: 0 0 26px; padding: 14px 16px;
  font-size: 14px; color: var(--ivory-dim);
  background: rgba(0, 0, 0, .22); border-radius: var(--r-ctl);
}
.group { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
.group legend { font-family: var(--serif); font-size: 21px; padding: 0; margin-bottom: 12px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg-grid { grid-auto-flow: row; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.seg-btn {
  min-height: 44px; padding: 8px 6px;
  border: 1px solid var(--seam); border-radius: 9px;
  background: rgba(0, 0, 0, .22); color: var(--ivory);
  font-size: 15px; font-weight: 500; cursor: pointer;
}
.seg-btn[aria-checked="true"] { background: var(--gold); color: #1B1406; border-color: var(--gold); }
.seg-btn.is-red { color: var(--rouge-soft); }
.seg-btn.is-red[aria-checked="true"] { color: var(--rouge); }
.seg-btn.is-big { font-size: 24px; line-height: 1; }
.seg-btn.is-wide { grid-column: 1 / -1; }
/* Options illustrées (pièces, balles, billets, dos) */
.thumb-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; }
.opt-img { width: 52px; height: 52px; object-fit: contain; display: block; }
.opt-img.is-wide { width: 84px; height: 42px; }
.opt-img.is-tall { width: 40px; height: 56px; }
.opt-name { font-size: 12.5px; line-height: 1.2; text-align: center; }
.seg-btn[aria-checked="true"] .opt-img { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); }
.coin-preview { display: flex; align-items: center; gap: 16px; margin: 0 0 12px; }
.coin-preview img { width: 96px; height: 96px; object-fit: contain; }
.coin-preview figcaption { font-family: var(--serif); font-size: 21px; line-height: 1.2; }
.seg + .seg, .picker .seg + .seg { margin-top: 8px; }

.preview { display: flex; align-items: center; gap: 16px; margin: 0 0 14px; }
.preview-img { width: 76px; aspect-ratio: 5 / 7; object-fit: contain; flex: none; }
.preview-cap { font-family: var(--serif); font-size: 24px; line-height: 1.15; margin: 0; }

.slider { display: block; margin-top: 16px; }
.slider-head { display: flex; justify-content: space-between; font-size: 14px; color: var(--mute); }
.slider output { color: var(--ivory); font-variant-numeric: tabular-nums; }
.slider input { width: 100%; margin: 8px 0 0; accent-color: var(--gold); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; }
.toggle + .toggle { border-top: 1px solid var(--seam); }
.toggle-text { display: flex; flex-direction: column; }
.toggle-text small { color: var(--mute); font-size: 13px; }
.toggle input { width: 24px; height: 24px; flex: none; accent-color: var(--gold); }

.tapmaps { display: flex; gap: 14px; margin-bottom: 6px; }
.tapmaps figure { margin: 0; flex: 1; max-width: 140px; }
.tapmaps figcaption { margin-top: 6px; font-size: 13px; color: var(--mute); text-align: center; }
.tapmap {
  display: grid;
  width: 100%; aspect-ratio: 9 / 19.5;
  background: #000; color: rgba(243, 236, 221, .8);
  border: 2px solid var(--ivory-dim); border-radius: 16px;
  overflow: hidden; line-height: 1;
}
.tapmap span { display: grid; place-items: center; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.tapmap .is-red { color: var(--rouge-soft); }
.tapmap-values { grid-template: repeat(5, 1fr) / repeat(3, 1fr); font-size: 13px; }
.tapmap-values span { border-right: 1px solid rgba(255, 255, 255, .1); }
.tapmap-values .is-wide { grid-column: 1 / -1; }
.tapmap-suits { font-size: 26px; }
.tapmap-suits.is-quarters { grid-template: 1fr 1fr / 1fr 1fr; }
.tapmap-suits.is-quarters span { border-right: 1px solid rgba(255, 255, 255, .1); }
.tapmap-suits.is-rows { grid-template-rows: repeat(4, 1fr); }
.tapmap-suits.is-cols { grid-template-columns: repeat(4, 1fr); font-size: 20px; }
.tapmap-suits.is-cols span { border-bottom: 0; border-right: 1px solid rgba(255, 255, 255, .1); }
.tapmap-cross { position: relative; display: block; }
.tapmap-cross svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tapmap-cross path { stroke: rgba(255, 255, 255, .25); stroke-width: 1; fill: none; }
.tapmap-cross span { position: absolute; font-size: 24px; line-height: 1; transform: translate(-50%, -50%); border: 0; display: block; }
.tapmap-cross .at-top { left: 50%; top: 16%; }
.tapmap-cross .at-bottom { left: 50%; top: 84%; }
.tapmap-cross .at-left { left: 18%; top: 50%; }
.tapmap-cross .at-right { left: 82%; top: 50%; }
.tapmap-cross.is-overlay span { font-size: 60px; }
.card-overlay .tapmap-cross.is-overlay span { font-size: 40px; }
.tapmap.is-overlay {
  position: absolute; inset: 0;
  width: auto; aspect-ratio: auto;
  border: 0; border-radius: 0; background: transparent;
  color: rgba(255, 255, 255, .2);
}
.tapmap-values.is-overlay { font-size: 34px; }
.tapmap-suits.is-overlay { font-size: 64px; }
.tapmap.is-overlay .is-red { color: rgba(236, 138, 146, .3); }
.tapmap.is-overlay span { border-color: rgba(255, 255, 255, .08); }
.card-overlay { position: absolute; z-index: 3; border-radius: 4%; overflow: hidden; }
.card-overlay .tapmap.is-overlay { background: rgba(0, 0, 0, .45); color: rgba(255, 255, 255, .7); }
.card-overlay .tapmap-values.is-overlay { font-size: 20px; }
.card-overlay .tapmap-suits.is-overlay { font-size: 40px; }
.card-overlay .tapmap.is-overlay .is-red { color: rgba(236, 138, 146, .9); }
.card-overlay .tapmap.is-overlay span { border-color: rgba(255, 255, 255, .25); }

.launch {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  margin-top: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

.facts { margin: 0 0 24px; }
.facts dt { color: var(--mute); font-size: 14px; }
.facts dd { margin: 2px 0 14px; font-size: 17px; overflow-wrap: anywhere; }
#screen-account .group { margin-bottom: 20px; }
#screen-account .hint { margin-top: 10px; }
#install-box .btn { margin-top: 12px; }

/* ---------- Scène ---------- */
#stage {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: #000;
  touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  cursor: none;
}
#stage-layer { position: absolute; inset: 0; pointer-events: none; }
/* La carte à l'écran : position et opacité sur #actor, retournement sur .actor-flip */
#actor {
  position: relative; z-index: 2;
  width: var(--card-w, 380px);
  aspect-ratio: 63 / 88;
  opacity: 0;
  perspective: 1400px;
  pointer-events: none;
  will-change: transform, opacity;
}
.actor-flip { position: absolute; inset: 0; transform-style: preserve-3d; }
.side {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.side-back { transform: rotateY(180deg); }
#actor.is-biz .side { object-fit: fill; }          /* carte de visite : l'image remplit les dimensions réglées */
.side:not([src]) { visibility: hidden; }
.rub-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* ---------- Mentalisme : outils réalistes ---------- */
.mental { position: absolute; inset: 0; z-index: 9; }
.hand { font-family: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive; }

/* Calculatrice */
.mental.calc { display: flex; flex-direction: column; justify-content: flex-end; font-family: -apple-system, 'SF Pro Display', system-ui, Roboto, sans-serif;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 22px); }
.calc-display { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; padding: 0 8px 14px; }
.calc-expr { font-size: 24px; opacity: .6; min-height: 1.2em; }
.calc-value { font-size: calc(min(22vw, 92px) * var(--fs, 1)); line-height: 1; font-weight: 300; white-space: nowrap; letter-spacing: -.02em; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.calc-key { aspect-ratio: 1; border: 0; font: inherit; font-size: 34px; cursor: pointer; transition: filter .1s; }
.calc-key.is-down { filter: brightness(1.5); }
.is-ios { background: #000; color: #fff; }
.is-ios .calc-key { border-radius: 50%; background: #333; color: #fff; }
.is-ios .k-fn { background: #a5a5a5; color: #000; font-size: 28px; }
.is-ios .k-op { background: #ff9f0a; color: #fff; font-size: 40px; }
.is-ios .k-wide { grid-column: span 2; aspect-ratio: auto; border-radius: 999px; text-align: left; padding-left: 32px; }
.is-android { background: #101418; color: #e2e2e6; }
.is-android .calc-keys { grid-template-columns: repeat(4, 1fr); gap: 10px; }
.is-android .calc-key { border-radius: 28%; background: #2b3036; color: #e2e2e6; font-size: 30px; }
.is-android .k-fn { background: #3c4a54; color: #c5e7ff; }
.is-android .k-op { background: #3c4a54; color: #c5e7ff; font-size: 34px; }
.is-android .k-eq { background: #7fcfff; color: #003549; font-size: 34px; }

/* Recherche */
.mental.search { background: #fff; color: #202124; font-family: system-ui, -apple-system, Roboto, sans-serif; overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 26px) 14px 30px; }
.srch-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; background: #f1f3f4; }
.srch-input { flex: 1; border: 0; background: none; font: inherit; font-size: 17px; outline: none; color: inherit; min-width: 0; }
.srch-ico { color: #5f6368; font-size: 20px; }
.srch-home { padding: 18vh 6px 26px; display: flex; justify-content: center; }
.srch-logo { display: flex; align-items: center; gap: 10px; color: #1f3a5f; font: 600 40px/1 system-ui, -apple-system, Roboto, sans-serif; letter-spacing: -.02em; }
.srch-logo svg { width: 38px; height: 38px; color: #2a7de1; }
.srch-logo.is-small { font-size: 20px; gap: 6px; margin: 0 2px 10px; }
.srch-logo.is-small svg { width: 20px; height: 20px; }
.srch-greet { font-size: 28px; font-weight: 600; margin: 0 0 24px; color: #3c4043; }
.srch-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 10px; }
.srch-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: #3c4043; }
.srch-tile i { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-style: normal; font-weight: 600; font-size: 20px; }
.srch-sugg { display: flex; flex-direction: column; }
.srch-grip { position: fixed; left: 0; right: 0; top: 0; height: calc(env(safe-area-inset-top, 0px) + 22px); z-index: 2; touch-action: none; }
.srch-clear { border: 0; background: #c4c7c5; color: #fff; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; line-height: 22px; padding: 0; }
button.srch-r { width: 100%; text-align: left; border: 0; border-bottom: 1px solid #f1f3f4; background: none; font: inherit; color: inherit; cursor: pointer; }
.srch-imgs.real { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 12px 4px; }
.srch-imgs.real img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #eee; }
.srch-article { padding: 10px 4px 30px; }
.srch-back { border: 0; background: none; color: #1a73e8; font: inherit; padding: 6px 0 10px; }
.srch-atitle { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; font-size: 28px; margin: 4px 0 12px; color: #202124; }
.srch-aimg { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; }
.srch-atext { font-size: 16px; line-height: 1.55; color: #202124; }
.srch-s { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 6px; border: 0; background: none; font: inherit; color: inherit; border-bottom: 1px solid #f1f3f4; }
.srch-results { padding-top: 6px; }
.srch-tabs { display: flex; gap: 18px; font-size: 14px; color: #5f6368; padding: 12px 4px; border-bottom: 1px solid #ebebeb; overflow: hidden; }
.srch-tabs .is-on { color: #1a73e8; border-bottom: 2px solid #1a73e8; padding-bottom: 8px; }
.srch-count { font-size: 13px; color: #70757a; margin: 10px 4px; }
.srch-r { display: flex; flex-direction: column; padding: 12px 4px; border-bottom: 1px solid #f1f3f4; }
.srch-site { font-size: 12px; color: #4d5156; }
.srch-title { font-size: 18px; color: #1a0dab; margin: 2px 0; }
.srch-desc { font-size: 14px; color: #4d5156; }
.srch-imgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 12px 4px; }
.srch-imgs i { aspect-ratio: 1; border-radius: 8px; }

/* Bloc-notes */
.mental.notes { display: flex; flex-direction: column; background: #fdfbf4; color: #1d1d1f; font-family: -apple-system, system-ui, Roboto, sans-serif; }
.note-head { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 8px; color: #c58a00; font-size: 17px; }
.note-date { color: #8e8e93; font-size: 13px; }
.note-ok { border: 0; background: none; color: #c58a00; font: inherit; font-weight: 600; font-size: 17px; }
.note-canvas { flex: 1; width: 100%; touch-action: none; }
.note-canvas.is-lined { background: repeating-linear-gradient(transparent 0 31px, #e6e2d6 31px 32px); }
.note-bar { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); border-top: 1px solid #e8e4d8; }
.note-pen { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; background: var(--c); box-shadow: 0 0 0 1px #d1cfc7; }
.note-pen.is-on { border-color: #fdfbf4; box-shadow: 0 0 0 2px var(--c); }
.note-tool { border: 0; background: none; font-size: 24px; margin-left: 12px; }

/* QR du choix à distance, lecture secrète, fiche */
.mental.mental-qr { display: grid; place-items: center; background: #000; }
.mental.mental-qr.is-blank { background: transparent; pointer-events: none; }
.mqr { background: #fff; padding: 8px; border-radius: 10px; }
.mqr svg { display: block; width: 100%; height: auto; }
.mental.peek { display: grid; place-items: center; background: transparent; color: #fff; pointer-events: none; }
.mental.peek span { font-size: 44px; text-align: center; padding: 0 20px; }
.mental.peek img { max-width: 70vw; max-height: 50vh; filter: invert(1); }
.mental.peek.is-corner { place-items: end center; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px); }
.mental.peek.is-corner span { font-size: 16px; }
.mental.peek.is-corner img { max-width: 30vw; }
.mental.fiche-wrap { display: grid; place-items: center; background: #000; }
.fiche { aspect-ratio: 127 / 76; background: #fbf9f3; border-radius: 3px; box-shadow: 0 12px 30px rgba(0,0,0,.55);
  background-image: linear-gradient(transparent 21%, #e35b5b 21%, #e35b5b 21.6%, transparent 21.6%), repeating-linear-gradient(transparent 0 calc(13% - 1px), #c9d8ec calc(13% - 1px) 13%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6% 8% 4%; color: #1b2a5c; text-align: center; }
.fiche-pre { margin: 0; font-size: clamp(18px, 5.5vw, 26px); opacity: .85; }
.fiche-txt { margin: 0; font-size: clamp(36px, 12vw, 64px); line-height: 1.05; }
.fiche-img { max-width: 70%; max-height: 70%; object-fit: contain; mix-blend-mode: multiply; }

/* Caméra */
#cam { position: absolute; inset: 0; z-index: 8; background: #000; pointer-events: none; }
#cam[hidden] { display: none; }
.cam-view { width: 100%; height: 100%; display: block; }
.cam-ui { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px); }
.cam-panel { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; background: rgba(3, 14, 30, .78); max-width: 86%; }
.cam-qr { width: min(56vw, 240px); background: #fff; border-radius: 10px; padding: 6px; }
.cam-qr svg { display: block; width: 100%; height: auto; }
.cam-msg { margin: 0; color: var(--ivory); font-size: 15px; text-align: center; }
.cam-share { width: auto; }
.cam-flash { position: absolute; inset: 0; background: #fff; pointer-events: none; }
/* Photo en secret : la caméra tourne, l'écran reste noir (en entraînement, image en transparence) */
#cam.is-secret .cam-view, #cam.is-secret .cam-flash { opacity: 0; }
#cam.is-secret.is-practice .cam-view { opacity: .3; }
.signed-preview { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(3, 14, 30, .82); max-width: 86%; }
.signed-preview img { width: min(42vw, 190px); height: auto; border-radius: 6px; box-shadow: 0 6px 22px rgba(0, 0, 0, .5); }
.signed-preview .row { display: flex; gap: 10px; }
.signed-preview .btn { width: auto; }

/* QR code */
#qr { position: absolute; left: 50%; top: 50%; opacity: 0; z-index: 6; pointer-events: none; border-radius: 6px; overflow: hidden; }
#qr svg { display: block; width: 100%; height: 100%; }

/* Objet plié (billet, carte) : vraie feuille en 3D, voir js/fold.js */
#fold { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; pointer-events: none; z-index: 5; }
.fold-fx { position: absolute; left: 0; top: 0; width: 0; height: 0; perspective-origin: 0 0; }
.fold-pop, .fold-turn, .fold-skew, .fold-shift, .fold-sheet, .fold-row, .fold-col { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.fold-col { transform-origin: 0 50%; }
.fold-row { transform-origin: 50% 0; }
.fold-face { position: absolute; inset: 0; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.fold-face.b { transform: rotateY(180deg); }
.fold-pic { position: absolute; background-size: 100% 100%; background-repeat: no-repeat; }
.fold-shade, .fold-crease { position: absolute; inset: 0; pointer-events: none; }

/* Balles éponges */
#balls { position: absolute; inset: 0; pointer-events: none; }
.ball {
  position: absolute; left: 50%; top: 50%;
  width: var(--bpx, 230px); aspect-ratio: 1;
  margin-left: calc(var(--bpx, 230px) * -0.5); margin-top: calc(var(--bpx, 230px) * -0.5);
  opacity: 0; will-change: transform, opacity;
}
.ball-squash, .ball-spin { position: absolute; inset: 0; }
.ball-spin img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ball-spin img:not([src]) { visibility: hidden; }

#stage-note {
  position: absolute; left: 0; right: 0; z-index: 3;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  margin: 0; text-align: center;
  font-size: 15px; color: rgba(255, 255, 255, .4);
  pointer-events: none;
}

/* ---------- Routines ---------- */
.field { display: block; font-size: 14px; color: var(--mute); margin-bottom: 22px; }
.field input {
  display: block; width: 100%; margin-top: 6px; padding: 13px 14px;
  font: 18px var(--sans); color: var(--ivory);
  background: rgba(0, 0, 0, .3); border: 1px solid var(--seam); border-radius: var(--r-ctl);
}
.field input:focus { outline: none; border-color: var(--ivory); }
.section-title { font-family: var(--serif); font-weight: 400; font-size: 21px; margin: 0 0 12px; }
.empty { color: var(--mute); font-size: 15px; margin: 0 0 16px; list-style: none; }
.hint.lead { margin: 0 0 22px; }
.hint.lead p { margin: 0 0 6px; }
.hint.lead ol { margin: 0 0 6px; padding-left: 20px; }
.hint.lead li { margin: 0 0 4px; }
.field-label { margin-top: 18px; }
.sub { margin-top: 10px; }
.card-source .seg { margin-bottom: 4px; }
.card-source .preview { margin-top: 14px; }

.origin-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: rgba(227, 181, 91, .14); border: 1px solid rgba(227, 181, 91, .45); }
.example-pitch { margin-top: 4px; font-size: 13px; line-height: 1.35; opacity: .72; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Explication d'un exemple */
.explain { margin: 0 0 16px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(227, 181, 91, .35); }
.explain > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; color: var(--gold); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.explain > summary::-webkit-details-marker { display: none; }
.explain > summary::after { content: '▾'; transition: transform .2s; }
.explain:not([open]) > summary::after { transform: rotate(-90deg); }
.explain > .hint { margin: 0 14px 8px; }
.explain-part { padding: 0 14px 12px; }
.explain-part h3 { margin: 6px 0 6px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; opacity: .7; font-family: inherit; font-weight: 600; }
.explain-part p, .explain-part li { font-size: 15px; line-height: 1.5; }
.explain-part p { margin: 0; }
.explain-part ul, .explain-part ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.explain-part ol li::marker { color: var(--gold); font-weight: 700; }
.origin-note.is-ok { background: rgba(80, 170, 110, .14); border-color: rgba(80, 170, 110, .5); }
.routine-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.routine-row {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px 6px 4px;
  background: var(--ivory); color: var(--ink);
  border-radius: var(--r-card);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .4);
}
.routine-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start;
  padding: 10px 12px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.home-bar { justify-content: space-between; }
.routine-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.routine-tools .btn-small.is-on { background: var(--gold); color: #1B1406; border-color: var(--gold); }
.order-btns { display: flex; flex-direction: column; gap: 4px; margin-right: 8px; }
.order-btns .icon-btn { width: 40px; height: 34px; background: var(--velvet); color: var(--gold); border-color: var(--velvet); font-size: 13px; }
.order-btns .icon-btn:disabled { opacity: .3; }
.routine-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 4px; font-size: 13px; color: var(--mute); }
.routine-legend .ico { background: var(--ivory); border-radius: 6px; padding: 2px; }
.routine-legend .ico + .ico, .routine-legend .ico:nth-of-type(2) { margin-left: 10px; }
.routine-origin { display: grid; place-items: center; width: 40px; height: 40px; flex: none; margin-left: 8px; border-radius: 10px; background: rgba(26, 21, 23, .06); }
.routine-origin svg { width: 26px; height: 26px; }
.routine-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.routine-objects { display: inline-flex; gap: 4px; }
.routine-objects svg { width: 20px; height: 20px; display: block; }
.routine-name { font-family: var(--serif); font-size: 21px; line-height: 1.15; overflow-wrap: anywhere; }
.routine-meta { font-size: 13px; color: #66718A; }
.play-btn { background: var(--velvet); color: var(--gold); border-color: var(--velvet); }
.play-btn:disabled { opacity: .35; }

.step-list { list-style: none; margin: 0 0 14px; padding: 0; counter-reset: none; }
.step-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--seam);
}
.step-row:first-child { border-top: 1px solid var(--seam); }
.step-num {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 42px; border-radius: 5px;
  background: var(--ivory); color: var(--ink);
  font-family: var(--serif); font-size: 17px;
}
.step-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start;
  padding: 4px 0; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.step-title { font-weight: 600; }
.step-sum { font-size: 13px; color: var(--mute); line-height: 1.35; }
.step-tools { display: flex; flex: none; }
.tool {
  display: grid; place-items: center; width: 34px; height: 40px;
  border: 0; background: transparent; color: var(--ivory-dim); cursor: pointer;
}
.tool:disabled { opacity: .25; cursor: default; }
.ico { display: grid; place-items: center; }

.routine-settings { margin-top: 30px; }
.row-actions { display: flex; gap: 10px; margin: 6px 0 18px; }
.row-actions .btn { flex: 1; }
.btn-danger { color: var(--rouge-soft); }
.row-actions { flex-wrap: wrap; }
.row-actions .btn { min-width: 30%; }
.sync-box { margin-top: 30px; }

.type-list { display: flex; flex-direction: column; gap: 26px; }
.mode-toggle { margin-bottom: 4px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tool-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 16px 10px 14px; cursor: pointer;
  border: 0; border-radius: var(--r-card); background: var(--ivory); color: var(--ink);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.tool-tile:active { transform: scale(.98); }
.tool-visual { display: grid; place-items: center; height: 76px; }
.tool-img { width: 64px; height: 64px; object-fit: contain; }
.tool-img.is-wide { width: 112px; height: 56px; }
.tool-title { font-family: var(--serif); font-size: 19px; line-height: 1.15; }
.tool-text { font-size: 12.5px; line-height: 1.35; color: #54607A; }
.back-link { align-self: flex-start; background: none; border: 0; color: var(--ivory-dim); font-size: 15px; padding: 6px 0; cursor: pointer; }
.tool-head { display: flex; align-items: center; gap: 14px; }
.tool-head .section-title { margin: 0; font-size: 26px; }
.tool-head-img { width: 56px; height: 56px; object-fit: contain; }
.tool-head-img.is-wide { width: 96px; height: 48px; }
.effect-row .type-title { font-size: 19px; }
.type-cat { display: flex; flex-direction: column; gap: 10px; }
.type-cat .section-title { margin: 0 0 2px; }
.type-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 14px 16px; text-align: left;
  border: 1px solid var(--seam); border-radius: var(--r-ctl);
  background: rgba(0, 0, 0, .22); cursor: pointer;
}
.type-row:active { background: rgba(0, 0, 0, .4); }
.type-title { font-family: var(--serif); font-size: 21px; }
.type-desc { font-size: 14px; color: var(--mute); }

.swatch-label { display: inline-flex; align-items: center; gap: 7px; }
.seg-btn[aria-checked="true"] .swatch { box-shadow: 0 0 0 1.5px var(--ink); }
.stack-example { margin: 4px 0 0; font-family: var(--serif); font-size: 20px; letter-spacing: .02em; }
.swatch.is-round { border-radius: 50%; width: 16px; height: 16px; }
.swatch { display: inline-block; width: 14px; height: 18px; border-radius: 3px; box-shadow: 0 0 0 1.5px var(--ivory); }

/* ---------- Calibrage ---------- */
.calib-stage { display: grid; place-items: center; min-height: 360px; margin: 18px 0; }
.calib-shape { border: 2px solid var(--ivory); background: rgba(243, 236, 221, .08); }
.calib-shape.is-card { border-radius: 3.5mm; }
.calib-shape.is-coin { border-radius: 50%; }
.calib-row { display: flex; align-items: center; gap: 12px; }
.calib-row input { flex: 1; accent-color: var(--gold); }
.calib-value { text-align: center; }
#screen-calibrate .seg { margin-bottom: 4px; }
#screen-calibrate .btn-quiet { margin-top: 8px; }
.btn-inline { margin: 10px 0 6px; }

/* ---------- Paramètres : taille des objets ---------- */
.bar-tools { display: flex; gap: 8px; }
.obj-group { margin-bottom: 22px; }
.obj-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 10px 12px; margin-bottom: 8px; text-align: left; cursor: pointer;
  border: 1px solid var(--seam); border-radius: var(--r-ctl); background: rgba(0, 0, 0, .22);
}
.obj-thumb { width: 44px; height: 44px; object-fit: contain; flex: none; }
.obj-thumb.is-wide { width: 64px; height: 32px; }
.obj-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.obj-name { font-weight: 600; }
.obj-detail { font-size: 13px; color: var(--mute); }
.obj-state { font-size: 12.5px; color: var(--mute); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--seam); }
.obj-state.is-set { background: var(--gold); color: #1B1406; border-color: var(--gold); }
.objsize-stage { display: grid; place-items: center; margin: 16px -20px; background: #000; min-height: 200px; overflow: hidden; }
#objsize-img { object-fit: fill; display: block; }

#souvenir-box { margin-bottom: 30px; }
#perm-box { margin-bottom: 30px; }
.perm-qr { width: min(60vw, 220px); background: #fff; padding: 8px; border-radius: 10px; margin: 6px 0 10px; }
.perm-qr svg { display: block; width: 100%; height: auto; }
.perm-url { font-size: 14px; color: var(--gold); word-break: break-all; margin: 0 0 10px; }
.sub-title { font-size: 18px; margin-top: 18px; }
.media-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.media-item { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border: 1px solid var(--seam); border-radius: var(--r-ctl); }
.media-item img { width: 44px; height: 64px; object-fit: cover; border-radius: 6px; flex: none; }
.media-text { flex: 1; display: flex; flex-direction: column; font-size: 14px; }
.media-text small { color: var(--mute); }

/* ---------- Installation ---------- */
.install-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 18px; padding: 10px 8px 10px 12px;
  border: 1px solid var(--seam); border-radius: 12px;
  background: rgba(0, 0, 0, .28);
}
.install-banner img { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.install-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; }
.btn-small { width: auto; min-height: 38px; padding: 8px 14px; font-size: 14px; flex: none; }
#gate-install .install-banner { margin: 22px 0 0; }

.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh;
  margin: auto auto 0; padding: 0;
  border: 0; border-radius: 18px 18px 0 0;
  background: var(--velvet); color: var(--ivory);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .6);
  overflow: auto;
}
.sheet[open] { animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
.sheet::backdrop { background: rgba(0, 0, 0, .62); }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
.sheet-inner {
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
}
.sheet-inner > p { margin: 0; }
.sheet-head { display: flex; gap: 14px; align-items: center; }
.sheet-head img { width: 56px; height: 56px; border-radius: 13px; flex: none; }
.sheet-head .hint { margin-top: 2px; }
.sheet-title { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.1; margin: 0; }
.sheet-ok { font-size: 17px; }
.btn-quiet { background: transparent; color: var(--mute); font-weight: 500; }
a.btn { text-align: center; text-decoration: none; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--seam);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step);
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ivory); color: var(--ink);
  font-weight: 600; font-size: 14px;
}
.steps li > span { padding-top: 3px; }
.key {
  display: inline-grid; place-items: center; vertical-align: -6px;
  min-width: 26px; height: 26px; padding: 0 4px; margin: 0 2px;
  border-radius: 7px; background: rgba(243, 236, 221, .14); color: var(--ivory);
}
.key-text { font-weight: 600; font-size: 16px; line-height: 1; vertical-align: -4px; }
.note { padding: 12px 14px; border-radius: var(--r-ctl); background: rgba(0, 0, 0, .25); color: var(--ivory-dim); }
.qr { display: grid; place-items: center; padding: 14px; background: var(--ivory); border-radius: var(--r-card); width: max-content; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mode, button.mode:active { transition: none; }
}

/* Appli « quittée » : écran noir total, le téléphone se met en veille */
#sleep { position: fixed; inset: 0; z-index: 9999; background: #000; touch-action: none; cursor: none; }

/* Avant cette étape */
.needs { margin: 0 0 18px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line, #1F3A62); background: rgba(255,255,255,.03); }
.needs-title { margin: 0 0 6px; font-weight: 600; font-size: 14px; }
.needs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.needs li { display: flex; gap: 8px; font-size: 14px; line-height: 1.35; }
.needs small { color: var(--mute); font-size: 13px; }
.needs-mark { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.needs .is-ok .needs-mark { background: rgba(80, 170, 110, .25); color: #8fe0a8; }
.needs .is-missing .needs-mark { background: rgba(230, 120, 90, .3); color: #ffb39c; }
.needs .is-opt .needs-mark, .needs .is-setup .needs-mark { background: rgba(255,255,255,.1); color: var(--mute); }
.step-warn { display: block; color: #ffb39c; font-size: 12px; font-weight: 600; }

/* Musique de la routine */
.music-box { margin: 6px 0 4px; }
.music-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 12px; }
.music-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.music-actions { display: flex; gap: 8px; }
.music-actions .btn { flex: 1; }
.music-box .seg { margin: 8px 0 4px; }
.music-box .form-msg:empty { min-height: 0; margin: 0; }

/* Exemples : filtre par thème */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin: 0 -2px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line, #1F3A62); background: transparent; color: inherit; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip.is-on { background: var(--gold); border-color: var(--gold); color: #1B1406; }
.chip-n { font-size: 12px; opacity: .7; font-weight: 500; }
.example-group { display: flex; flex-direction: column; gap: 12px; }
.example-group + .example-group { margin-top: 10px; }
.example-group .section-title { margin: 6px 0 0; }
.routine-list > .chips { margin-bottom: -4px; }

/* Catégories de routines */
.chips-wrap { flex-wrap: wrap; overflow: visible; }
.tag-add { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.tag-add input { flex: 1; min-width: 0; }
.tag-tools { display: flex; gap: 18px; margin: -4px 0 2px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--gold); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }
.routine-tags { font-size: 12px; opacity: .75; }
.tag-add.field { display: flex; margin: 8px 0 0; }
.tag-add.field input { margin-top: 0; font-size: 16px; padding: 10px 12px; }
.tag-add .btn-small { min-height: 44px; }
.note-action { display: block; margin-top: 10px; }

/* Prédiction sur la table : enveloppe scellée sur l'écran du magicien */
.mental.table-pred { background: radial-gradient(ellipse at 50% 40%, #1a1712, #050403 70%); }
.tp-env { position: relative; aspect-ratio: 162 / 114; background: linear-gradient(160deg, #f4ecd9, #e3d6b8); border-radius: 4px;
  box-shadow: 0 18px 40px rgba(0,0,0,.6), inset 0 0 0 1px rgba(120,90,40,.25); overflow: hidden; }
.tp-flap { position: absolute; inset: 0 0 auto 0; height: 58%; background: linear-gradient(180deg, #ece0c3, #d9c9a4);
  clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .5s ease; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.tp-env.is-open .tp-flap { transform: rotateX(180deg); }
.tp-seal { position: absolute; left: 50%; top: 52%; width: 15%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #c7414a, #7d1820 70%); box-shadow: 0 2px 4px rgba(0,0,0,.35); transition: opacity .3s; }
.tp-env.is-open .tp-seal { opacity: 0; }
.tp-label { position: absolute; left: 0; right: 0; bottom: 9%; margin: 0; text-align: center; color: #3a2c18; font-size: clamp(20px, 6vw, 30px); }
.tp-card, .tp-env { grid-area: 1 / 1; }
.steps-list { margin: 6px 0 8px; padding-left: 20px; }
.steps-list li { margin: 3px 0; }
.needs .is-tip .needs-mark { background: rgba(227, 181, 91, .22); }
.needs .is-tip { color: var(--ivory); }

/* Boutique et étapes verrouillées */
.offer-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin: 0 0 10px;
  border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(227, 181, 91, .3); }
.offer-card.is-bundle { border-color: var(--gold); background: rgba(227, 181, 91, .1); }
.offer-card.is-owned { border-color: rgba(80, 170, 110, .5); }
.offer-card.is-later { opacity: .75; }
.offer-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.offer-text b { font-size: 16px; }
.offer-text span { font-size: 13.5px; opacity: .78; line-height: 1.35; }
.offer-text .offer-old { opacity: .6; }
.offer-card .btn { flex: none; width: auto; white-space: nowrap; }
.offer-owned { flex: none; color: #7fd49b; font-size: 14px; font-weight: 600; }
.unlock-part { display: flex; flex-direction: column; gap: 8px; }
.unlock-what { margin: 0; font-size: 15px; }
.buy-offers { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; }
.buy-offer { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(227, 181, 91, .3); color: inherit; font: inherit; }
.buy-offer[aria-checked="true"] { border-color: var(--gold); background: rgba(227, 181, 91, .14); box-shadow: 0 0 0 1px var(--gold) inset; }
.buy-offer .bo-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.buy-offer .bo-text span { font-size: 13px; opacity: .78; line-height: 1.35; }
.buy-offer .bo-price { font-weight: 700; white-space: nowrap; }
.buy-offer .bo-price s { opacity: .55; font-weight: 400; margin-right: 6px; }
.lock-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(227, 181, 91, .18); color: var(--gold); vertical-align: middle; white-space: nowrap; }
.type-row.is-locked, .tool-tile.is-locked { opacity: .82; }
.step-lock { display: block; font-size: 12.5px; color: var(--gold); margin-top: 2px; }
.routine-row .lock-tag, .tool-tile .lock-tag { background: var(--navy, #0C2140); color: var(--gold); }
.routine-name .lock-tag { font-family: system-ui, sans-serif; font-size: 11.5px; }

/* Dés forcés : appli de lancer de dés (style « outil de jeu de rôle », sans marque) */
.mental.dice-app { display: flex; flex-direction: column; background: #16141d; color: #ece9f5;
  font-family: system-ui, -apple-system, Roboto, sans-serif; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.dice-bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: #1f1c29; border-bottom: 1px solid #2c2839; }
.dice-bar b { flex: 1; font-size: 19px; font-weight: 650; letter-spacing: .01em; }
.dice-logo { color: #a78bfa; font-size: 22px; line-height: 1; }
.dice-chip { padding: 3px 10px; border-radius: 999px; background: #2c2645; color: #c4b5fd; font-size: 14px; font-weight: 600; }
.dice-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 18px; min-height: 0; }
.dice-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; max-width: 360px; }
.die { width: min(30vw, 120px); height: min(30vw, 120px); filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55)); }
.dice-tray:has(.die:nth-child(3)) .die { width: min(24vw, 96px); height: min(24vw, 96px); }
.die-body { fill: #2a2440; stroke: #a78bfa; stroke-width: 3; stroke-linejoin: round; }
.die-d6 .die-body { fill: #f3f0fa; stroke: #d5cfe6; }
.die-pip { fill: #1d1a28; }
.die-num { fill: #fff; font: 700 34px system-ui, sans-serif; }
.die-num.is-small { font-size: 26px; }
.dice-tray.is-rolling .die { animation: die-tumble .14s linear infinite; }
@keyframes die-tumble { 0% { transform: rotate(-14deg) translateY(-3px); } 50% { transform: rotate(12deg) translateY(2px); } 100% { transform: rotate(-14deg) translateY(-3px); } }
.dice-total { margin: 0; font-size: 34px; font-weight: 700; color: #fff; min-height: 1.2em; }
.dice-hist { list-style: none; margin: 0; padding: 0; width: min(100%, 360px); max-height: 30vh; overflow: hidden; }
.dice-hist li { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid #2a2636; font-size: 15px; color: #b9b3cc; }
.dice-hist li:first-child { color: #ece9f5; }
.dice-foot { padding: 14px 18px 20px; }
.dice-roll { width: 100%; padding: 16px; border: 0; border-radius: 14px; background: #7c5cff; color: #fff; font: 700 19px system-ui, sans-serif; letter-spacing: .02em; }
.dice-roll:active { transform: scale(.98); background: #6a4af0; }

/* Carnets de livres */
.books-list { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
.book-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: 14px;
  background: var(--ivory); color: var(--ink); border: 0; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 8px 20px rgba(0, 0, 0, .4); }
.book-name { font-family: var(--serif); font-size: 19px; }
.book-meta { font-size: 13px; opacity: .65; white-space: nowrap; }
.book-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.book-add-num { width: 90px !important; flex: none; }
.book-add-word { flex: 1; min-width: 140px; }
.book-add .btn { width: auto; }
.book-paste summary { cursor: pointer; font-weight: 600; color: var(--gold); padding: 4px 0; }
.book-paste textarea { width: 100%; margin-top: 8px; }
.book-pages { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.book-page { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; }
.book-num { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
/* Pavé secret (page du livre) */
.mental.book-pad { display: grid; grid-template-rows: 1fr auto; background: #000; color: #fff; }
.book-keys { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr); height: 100%; }
.book-keys button { background: transparent; border: 0; color: transparent; font: 600 30px system-ui, sans-serif; }
.book-pad.is-practice .book-keys button { color: rgba(255, 255, 255, .28); border: 1px solid rgba(255, 255, 255, .08); }
.book-typed { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); text-align: center; font-size: 13px; pointer-events: none; }
#book-body input, #book-body textarea {
  width: 100%; padding: 11px 12px; font: 16px var(--sans); color: var(--ivory);
  background: rgba(0, 0, 0, .3); border: 1px solid var(--seam); border-radius: var(--r-ctl);
}
#book-body input:focus, #book-body textarea:focus { outline: none; border-color: var(--ivory); }
#book-body textarea { font-family: ui-monospace, monospace; font-size: 15px; resize: vertical; }
#book-body .book-page input { padding: 8px 10px; }
#book-body input[type=search] { margin-top: 4px; }
#book-body .group > .field { margin-top: .9rem; }
/* Dés en 3D : le plateau prend la place disponible */
.dice-tray.is-3d { display: block; width: 100%; max-width: 520px; flex: 1; min-height: 240px; border-radius: 18px; overflow: hidden;
  box-shadow: inset 0 0 0 1px #2c2839; }
.dice-tray.is-3d canvas { display: block; }
.dice-main:has(.dice-tray.is-3d) { justify-content: flex-start; padding-top: 14px; }
.dice-main:has(.dice-tray.is-3d) .dice-hist { max-height: 22vh; }
/* Dice helper : croix pour fermer l'appli */
.dice-close { flex: none; width: 34px; height: 34px; margin-left: 4px; border: 0; border-radius: 50%; background: #2c2645; color: #d9d0ff;
  font: 600 17px/1 system-ui, sans-serif; display: grid; place-items: center; cursor: pointer; }
.dice-close:active { background: #3a3358; }
/* Lancers du spectateur reçus sur l'écran du magicien */
.mental.dice-peek { align-content: center; gap: 10px; }
.mental.dice-peek .dp-last { font-size: 64px; font-weight: 600; }
.mental.dice-peek .dp-prev { font-size: 20px; }
.mental.dice-peek.is-corner .dp-last { font-size: 22px; }
.mental.dice-peek.is-corner .dp-prev { font-size: 13px; }
.mental.dice-peek.is-corner { place-content: end center; }
/* Déroulé lu à voix haute */
.explain .explain-listen { width: auto; display: inline-flex; margin: 6px 14px 4px; min-height: 40px; padding: 8px 16px; }
/* Révélation caméra : aperçu de votre image sur une carte blanche */
.cam-presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 4px 0 12px; }
.cam-presets button { position: relative; min-width: 0; aspect-ratio: 1; overflow: hidden; padding: 0; border-radius: 10px; border: 2px solid transparent; background: #f4f2ee; cursor: pointer; display: grid; place-items: center; }
.cam-presets button img { position: absolute; inset: 7px; width: calc(100% - 14px); height: calc(100% - 14px); object-fit: contain; }
.cam-presets button.is-on { border-color: var(--gold); }
@media (max-width: 380px) { .cam-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cam-img-preview { width: 126px; height: 176px; margin: 10px auto 12px; border-radius: 8px; background: #fbfaf6;
  box-shadow: 0 4px 16px rgba(0,0,0,.35); display: grid; place-items: center; overflow: hidden; }
.cam-img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cam-img-preview .hint { color: #777; font-size: 13px; }

/* Mes dos de cartes */
.back-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 8px 0 14px; }
.back-tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.back-tile.is-hidden { opacity: .5; }
.back-tile input[type=text] { padding: 6px 8px; font-size: 14px; }
.back-img { width: 100%; aspect-ratio: 5 / 7; object-fit: contain; display: block; background: #000; border-radius: 6px; }
.back-name { font-size: 14px; }
.back-share { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.back-add { margin-top: 6px; }
.back-edit { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 14px; margin-top: 12px; align-items: start; }
.back-edit-ctl { display: flex; flex-direction: column; gap: 10px; }
.back-edit-ctl input[type=range] { width: 100%; accent-color: var(--gold); }
.back-preview { box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check-row input { margin-top: 3px; accent-color: var(--gold); }
@media (max-width: 420px) { .back-edit { grid-template-columns: 1fr; } .back-edit-view { max-width: 200px; margin: 0 auto; } }

/* Ma carte de visite */
.biz-real-wrap { overflow-x: auto; padding: 10px 0; }
.biz-real { position: relative; margin: 0 auto; border: 1.5px dashed var(--gold); border-radius: 3mm; background: rgba(255,255,255,.04); overflow: hidden; }
.biz-real-img { width: 100%; height: 100%; object-fit: fill; display: block; }
.biz-real-img:not([src]) { display: none; }
.biz-dims { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0; }
.biz-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.biz-num { width: 5.5em; text-align: center; }
.biz-presets { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.biz-prev { width: 100%; max-width: 220px; border-radius: 6px; display: block; }
.biz-current { margin: 6px 0; }

/* Documents légaux */
.consent-row { align-items: flex-start; font-size: 14px; line-height: 1.45; margin: 10px 0 12px; }
.consent-row input { margin-top: 3px; flex: none; }
.consent-row a, .legal-note a, .gate-legal a { color: var(--gold, #E3B55B); }
.legal-note { font-size: 13px; margin-top: 10px; }
.gate-legal { text-align: center; font-size: 12.5px; opacity: .8; margin: 22px 0 6px; }
