/* HUIS CLOS — composants réutilisables et leurs états */

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 52px; padding: 0 var(--s5);
  border-radius: var(--r-btn);
  font-family: var(--font-sans); font-size: var(--fs-ctrl); font-weight: 600; line-height: 1.2;
  color: var(--text); background: var(--surface-2);
  border: 1px solid transparent;
  text-decoration: none; white-space: nowrap;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-press), border-color var(--t-press), opacity var(--t-press), box-shadow var(--t-press);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active:not([disabled]) { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--amber); color: var(--amber-ink); box-shadow: 0 8px 24px rgba(230,183,124,0.18); }
.btn-primary:hover:not([disabled]) { background: var(--amber-2); }
.btn-secondary { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-secondary:hover:not([disabled]) { background: rgba(243,238,229,0.06); }
.btn-ghost { background: transparent; color: var(--text-2); min-height: 44px; padding: 0 var(--s3); }
.btn-ghost:hover:not([disabled]) { color: var(--text); background: rgba(243,238,229,0.05); }
.btn-quiet { background: rgba(243,238,229,0.06); color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(240,165,165,0.35); color: var(--error); }
.btn-lg { min-height: 56px; font-size: calc(var(--fs-ctrl) * 1.06); padding: 0 var(--s6); }
.btn-sm { min-height: 44px; padding: 0 var(--s4); font-size: var(--fs-meta); font-weight: 600; }
/* Bouton pleine largeur : un libellé trop long (prix, formule, autre langue, texte agrandi) passe à la ligne au lieu
   d'élargir l'écran. Une seule ligne quand il tient : rien ne change. */
.btn-block { width: 100%; white-space: normal; text-align: center; text-wrap: balance; padding-block: 10px; }
.btn-block > span { min-width: 0; }
.btn-icon { width: var(--tap); min-width: var(--tap); height: var(--tap); min-height: var(--tap); padding: 0; border-radius: 50%; background: rgba(20,28,38,0.85); color: var(--text); }
.btn-icon:hover { background: var(--surface-2); }
.btn-icon svg { width: 22px; height: 22px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); background: rgba(230,183,124,0.10); }
.btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--amber-ink) transparent var(--amber-ink) transparent; animation: spin 0.8s linear infinite; color: var(--amber-ink); }
.btn-secondary.is-loading::after, .btn-quiet.is-loading::after { border-color: var(--text) transparent var(--text) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-pill { border-radius: var(--r-chip); }
.btn-label-icon { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; min-height: 56px; padding: 6px 10px; border-radius: 16px; background: rgba(9,13,18,0.78); border: 1px solid rgba(243,238,229,0.14); color: var(--text); font-size: var(--fs-meta); font-weight: 600; backdrop-filter: none; }
.btn-label-icon svg { width: 22px; height: 22px; }
.btn-label-icon .badge { position: absolute; top: -4px; right: -4px; }

/* ---------- Barre haute et barre d'onglets ---------- */
.topbar { display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding: var(--s2) var(--s4); }
.topbar-title { flex: 1 1 auto; min-width: 0; font-family: var(--font-serif); font-size: var(--fs-h3); font-weight: 500; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { width: var(--tap); flex: none; }
.tabbar {
  display: flex; align-items: stretch; justify-content: space-around;
  border-top: 1px solid var(--line); background: rgba(9,13,18,0.92);
  padding: var(--s2) var(--s2) calc(var(--s2) + var(--safe-bottom));
  flex: none;
}
.tab { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 96px; min-height: 52px; padding: 6px 12px; border-radius: 14px; color: var(--text-2); font-size: var(--fs-meta); font-weight: 600; transition: color var(--t-press), background-color var(--t-press); }
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--amber); }
.tab:active { background: rgba(243,238,229,0.05); }

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-word { font-family: var(--font-serif); font-weight: 500; font-size: 15px; letter-spacing: 0.24em; text-transform: uppercase; }
.brand-word b { font-weight: 600; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border-radius: var(--r-card); border: 1px solid var(--line); }
.card-pad { padding: var(--s4); }
.card-elevated { background: var(--surface-2); box-shadow: var(--shadow-soft); }
.inv-card { display: block; overflow: hidden; color: inherit; text-decoration: none; width: 100%; text-align: left; }
.inv-visual { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.inv-visual svg, .inv-visual img { width: 100%; height: 100%; object-fit: cover; }
.inv-visual .chip { position: absolute; top: var(--s3); left: var(--s3); }
.inv-body { padding: var(--s4) var(--s4) var(--s5); }
.inv-title { font-family: var(--font-serif); font-size: var(--fs-h2); font-weight: 500; line-height: 1.15; margin-bottom: var(--s2); }
.inv-hook { color: var(--text-2); }
.inv-card:active .inv-visual { opacity: .92; }

.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--text-2); font-size: var(--fs-meta); font-weight: 500; letter-spacing: 0.01em; }
.meta-row .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

/* ---------- Puces / étiquettes ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 10px; border-radius: var(--r-chip); font-size: var(--fs-meta); font-weight: 600; letter-spacing: 0.02em; background: rgba(243,238,229,0.08); color: var(--text-2); border: 1px solid transparent; }
.chip-amber { background: rgba(230,183,124,0.14); color: var(--amber); }
.chip-blue { background: rgba(141,207,216,0.12); color: var(--blue); }
.chip-success { background: rgba(155,201,174,0.14); color: var(--success); }
.chip-error { background: rgba(240,165,165,0.14); color: var(--error); }
.chip-solid { background: var(--amber); color: var(--amber-ink); }
.chip-outline { background: rgba(9,13,18,0.7); border-color: var(--line-2); color: var(--text); }
.chip svg { width: 14px; height: 14px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: var(--amber-ink); font-size: 12px; font-weight: 700; }
.sim-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-chip); background: rgba(141,207,216,0.12); color: var(--blue); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.sim-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Messages ---------- */
.notice { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-btn); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: calc(var(--fs-body) * 0.94); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice-info { border-color: rgba(141,207,216,0.3); color: var(--text); }
.notice-info svg { color: var(--blue); }
.notice-error { border-color: rgba(240,165,165,0.4); color: var(--text); }
.notice-error svg { color: var(--error); }
.notice-success { border-color: rgba(155,201,174,0.4); color: var(--text); }
.notice-success svg { color: var(--success); }
.notice-amber { border-color: rgba(230,183,124,0.35); color: var(--text); }
.notice-amber svg { color: var(--amber); }
.notice strong { color: var(--text); }

/* ---------- État vide ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s6) var(--s5); border-radius: var(--r-card); border: 1px dashed var(--line-2); }
.empty svg { width: 44px; height: 44px; color: var(--blue); }
.empty h3 { font-family: var(--font-serif); font-size: var(--fs-h3); font-weight: 500; }
.empty p { color: var(--text-2); max-width: 28em; }

/* ---------- Panneaux (feuilles) ---------- */
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade-in var(--t-view) var(--ease-out) both; }
.scrim.is-leaving { animation: fade-out var(--t-view) var(--ease-in) both; }
@keyframes fade-out { to { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: min(92%, 100%);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-panel) var(--r-panel) 0 0;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.45); border-top: 1px solid var(--line-2);
  animation: sheet-in var(--t-view) var(--ease-out) both;
  padding-bottom: var(--safe-bottom);
}
.sheet.is-leaving { animation: sheet-out var(--t-view) var(--ease-in) both; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-out { to { transform: translateY(40px); opacity: 0; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 10px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4) var(--s3) var(--gutter); flex: none; }
.sheet-title { flex: 1 1 auto; font-family: var(--font-serif); font-size: var(--fs-h2); font-weight: 500; line-height: 1.15; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 var(--gutter) var(--s5); overscroll-behavior: contain; }
.sheet-actions { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--gutter) var(--s5); border-top: 1px solid var(--line); flex: none; }
.sheet-full { top: var(--safe-top); max-height: none; border-radius: var(--r-panel) var(--r-panel) 0 0; }
.sheet-side { top: 0; bottom: 0; left: auto; width: min(420px, 48%); max-height: none; border-radius: 0; border-left: 1px solid var(--line-2); border-top: 0; animation: side-in var(--t-view) var(--ease-out) both; }
.sheet-side.is-leaving { animation: side-out var(--t-view) var(--ease-in) both; }
@keyframes side-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes side-out { to { transform: translateX(40px); opacity: 0; } }

/* Modale centrée */
.modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--s5); }
.modal-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-panel); border: 1px solid var(--line-2); padding: var(--s5); box-shadow: var(--shadow); animation: modal-in var(--t-view) var(--ease-out) both; }
.modal-card.is-leaving { animation: modal-out var(--t-view) var(--ease-in) both; }
@keyframes modal-in { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: scale(0.98); } }

/* ---------- Toasts ---------- */
.toasts { position: absolute; left: var(--gutter); right: var(--gutter); top: calc(var(--safe-top) + 12px); display: flex; flex-direction: column; gap: var(--s2); z-index: 40; pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--s2); padding: 10px 14px; border-radius: var(--r-btn); background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font-size: var(--fs-meta); font-weight: 500; box-shadow: var(--shadow-soft); animation: rise-in var(--t-view) var(--ease-out) both; }
.toast.is-leaving { animation: fade-out var(--t-view) var(--ease-in) both; }
.toast svg { width: 16px; height: 16px; color: var(--success); flex: none; }
.toast-amber svg { color: var(--amber); }

/* ---------- Documents (le dossier vivant) ---------- */
.doc {
  position: relative; min-width: 0; overflow-wrap: break-word; background: var(--paper); color: var(--paper-ink);
  border-radius: var(--r-doc); box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 24px rgba(0,0,0,.35);
  font-family: var(--font-sans);
}
.doc::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.35), rgba(255,255,255,0) 40%, rgba(27,25,18,.05)); }
.doc-paper { background: var(--paper); }
.doc-paper-2 { background: var(--paper-2); }
.doc-lined { background-image: repeating-linear-gradient(0deg, transparent 0 27px, var(--paper-line) 27px 28px); background-position: 0 14px; }
.doc-full { padding: var(--s5) var(--s5) var(--s6); border-radius: 8px; }
.doc-kicker { font-size: var(--fs-meta); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--paper-ink-2); }
.doc-title { font-family: var(--font-serif); font-size: var(--fs-h2); font-weight: 600; line-height: 1.12; color: var(--paper-ink); margin-top: var(--s2); }
.doc-body { margin-top: var(--s4); color: var(--paper-ink); font-size: var(--fs-body); }
.doc-body p + p { margin-top: var(--s3); }
.doc-hand { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: calc(var(--fs-body) * 1.08); }
.doc-mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.doc-sign { margin-top: var(--s4); font-family: var(--font-serif); font-style: italic; color: var(--paper-ink-2); }
.doc-stamp { position: absolute; top: var(--s4); right: var(--s4); padding: 4px 8px; border: 2px solid rgba(184,71,47,.7); color: rgba(184,71,47,.85); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; transform: rotate(-6deg); border-radius: 3px; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: var(--s3); font-size: var(--fs-body); }
.doc-table th, .doc-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--paper-line); }
.doc-table th { font-size: var(--fs-meta); letter-spacing: .08em; text-transform: uppercase; color: var(--paper-ink-2); font-weight: 700; }
.doc-big { font-family: var(--font-serif); font-size: calc(var(--fs-display) * 1.1); font-weight: 600; letter-spacing: 0.04em; line-height: 1; }
/* Rangée de signes : 56 px par case au plus, les cases rétrécissent (carrées) quand il y en a beaucoup ou que l'écran est
   étroit (5 ou 6 signes à 320 px) ; la feuille ne déborde jamais. */
.doc-symbols { display: flex; gap: var(--s2); align-items: center; justify-content: center; padding: var(--s4) 0; min-width: 0; }
.doc-symbols .sym { flex: 0 1 56px; min-width: 0; aspect-ratio: 1 / 1; display: grid; place-items: center; border: 1.5px solid var(--paper-ink); border-radius: 4px; }
.doc-symbols .sym svg { width: 54%; height: auto; max-width: 30px; }
.doc-legend { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); align-items: center; margin-top: var(--s3); }
.doc-legend .sym { width: 40px; height: 40px; display: grid; place-items: center; border: 1.5px solid var(--paper-ink); border-radius: 4px; }
.doc-legend .sym svg { width: 22px; height: 22px; }
.doc-legend dd, .doc-legend dt { margin: 0; }
.doc-legend .letter { font-family: var(--font-serif); font-size: var(--fs-h2); font-weight: 600; }
.doc-dark { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); }
.doc-dark::before { background: linear-gradient(135deg, rgba(255,255,255,.06), transparent 50%); }
.doc-dark .doc-kicker { color: var(--text-2); }
.doc-dark .doc-title, .doc-dark .doc-body { color: var(--text); }
.doc-dark .doc-sign { color: var(--text-2); }
.doc-transcript { margin-top: var(--s4); padding: var(--s4); border-radius: var(--r-btn); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: calc(var(--fs-body) * 0.94); }
.doc-transcript h4 { font-size: var(--fs-meta); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-bottom: var(--s2); }

/* Miniatures d'objets — même identité dans la pièce, l'inspection et le carnet */
.obj { position: relative; display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 12px; background: rgba(9,13,18,0.55); border: 1.5px solid var(--line-2); transition: transform var(--t-press) var(--ease-out), border-color var(--t-press), box-shadow var(--t-press); }
.obj svg { width: 40px; height: 40px; }
.obj[data-state="available"] { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(230,183,124,0.14), 0 8px 24px rgba(230,183,124,0.18); }
.obj[data-state="discovered"] { border-color: rgba(243,238,229,0.5); }
.obj[data-state="used"] { border-color: var(--line); opacity: 0.75; }
.obj[data-state="locked"] { border-color: var(--line-2); }
.obj-state { position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); }
.obj-state svg { width: 12px; height: 12px; }
.obj[data-state="used"] .obj-state { background: var(--success); color: var(--ink); border-color: transparent; }
.obj[data-state="available"] .obj-state { background: var(--amber); color: var(--amber-ink); border-color: transparent; }
.obj-lg { width: 96px; height: 96px; border-radius: 18px; }
.obj-lg svg { width: 60px; height: 60px; }
.obj-sm { width: 44px; height: 44px; border-radius: 10px; }
.obj-sm svg { width: 28px; height: 28px; }

/* ---------- Repères spatiaux ---------- */

.statechip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px 6px 10px; border-radius: var(--r-chip); background: rgba(9,13,18,0.82); border: 1px solid rgba(243,238,229,0.16); color: var(--text); font-size: var(--fs-meta); font-weight: 600; }
.statechip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.statechip[data-state="searching"]::before { background: var(--blue); animation: breathe 1.6s ease-in-out infinite; }
.statechip[data-state="ready"]::before { background: var(--success); }
.statechip[data-state="lost"]::before, .statechip[data-state="error"]::before { background: var(--error); }
.statechip[data-state="lowlight"]::before { background: var(--amber); }
@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
:root[data-motion="reduced"] .statechip::before { animation: none; }

/* ---------- Champs de réponse ---------- */
.code-slots { display: flex; justify-content: center; gap: var(--s3); }
.code-slot { width: 64px; height: 76px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); border: 1.5px solid var(--line-2); font-family: var(--font-serif); font-size: 40px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; transition: border-color var(--t-press); }
.code-slot.is-active { border-color: var(--amber); }
.code-slot.is-error { border-color: var(--error); }
.code-slot.is-success { border-color: var(--success); color: var(--success); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: var(--s4); }
.key { min-height: 56px; border-radius: var(--r-btn); background: var(--surface-2); font-size: 24px; font-weight: 500; color: var(--text); font-family: var(--font-serif); transition: transform var(--t-press), background-color var(--t-press); }
.key:active { transform: scale(0.97); background: var(--surface-3); }
.key-soft { background: transparent; border: 1px solid var(--line-2); font-family: var(--font-sans); font-size: var(--fs-ctrl); font-weight: 600; }
.text-input { width: 100%; min-height: 64px; padding: 0 var(--s4); border-radius: var(--r-btn); background: var(--surface-2); border: 1.5px solid var(--line-2); color: var(--text); font-family: var(--font-serif); font-size: 32px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; text-align: center; transition: border-color var(--t-press); }
.text-input:focus { border-color: var(--amber); outline: none; }
.text-input.is-error { border-color: var(--error); }
.text-input::placeholder { color: var(--text-3); letter-spacing: 0.24em; font-weight: 400; }
.input { width: 100%; min-height: 48px; padding: 0 var(--s4); border-radius: var(--r-btn); background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font-size: var(--fs-ctrl); }
.input:focus { border-color: var(--amber); outline: none; }
.label { display: block; font-size: var(--fs-meta); font-weight: 600; color: var(--text-2); letter-spacing: 0.04em; margin-bottom: 6px; }
.segmented { display: grid; gap: var(--s2); }
.segmented[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.seg { min-height: 56px; border-radius: var(--r-btn); background: var(--surface-2); border: 1.5px solid transparent; color: var(--text); font-weight: 600; font-size: var(--fs-ctrl); display: grid; place-items: center; transition: border-color var(--t-press), background-color var(--t-press); }
.seg[aria-checked="true"] { border-color: var(--amber); background: rgba(230,183,124,0.12); color: var(--amber); }
.seg[disabled] { opacity: .4; }
.field-msg { min-height: 24px; margin-top: var(--s3); text-align: center; font-size: calc(var(--fs-body) * 0.94); color: var(--text-2); }
.field-msg.is-error { color: var(--error); }
.field-msg.is-success { color: var(--success); }

/* Choix du nombre de joueurs */
.count { min-height: 64px; border-radius: var(--r-card); background: var(--surface); border: 1.5px solid var(--line); font-family: var(--font-serif); font-size: 28px; font-weight: 500; color: var(--text); display: grid; place-items: center; transition: border-color var(--t-press), background-color var(--t-press); }
.count[aria-checked="true"] { border-color: var(--amber); background: rgba(230,183,124,0.10); color: var(--amber); }

/* Interrupteur */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 56px; padding: var(--s2) 0; }
.switch-row .switch-text { flex: 1 1 auto; min-width: 0; }
.switch-row .switch-text small { display: block; color: var(--text-2); font-size: var(--fs-meta); margin-top: 2px; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--surface-3); border: 1px solid var(--line-2); flex: none; transition: background-color var(--t-press); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text); transition: transform var(--t-press) var(--ease-out); }
.switch[aria-checked="true"] { background: var(--amber); border-color: var(--amber); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--amber-ink); }
.select-row { display: flex; gap: var(--s2); }
.select-row .seg { min-height: 44px; font-size: var(--fs-meta); flex: 1 1 0; min-width: 0; padding: 0 10px; text-align: center; }

/* ---------- Liste de réglages / d'indices ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--s3); min-height: 60px; padding: var(--s3) 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; color: var(--text); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-text { flex: 1 1 auto; min-width: 0; }
.list-item .li-title { display: block; font-weight: 600; font-size: var(--fs-ctrl); }
.list-item .li-sub { display: block; color: var(--text-2); font-size: var(--fs-meta); margin-top: 2px; }
.list-item .li-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--blue); flex: none; }
.list-item .li-icon svg { width: 20px; height: 20px; }
.list-item .li-chev { color: var(--text-3); flex: none; }
.list-item .li-chev svg { width: 18px; height: 18px; }
button.list-item:active { background: rgba(243,238,229,0.04); }
.list-item[aria-selected="true"] { background: rgba(230,183,124,0.08); }

/* ---------- Aides ---------- */
.hint-level { border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface-2); padding: var(--s4); }
.hint-level + .hint-level { margin-top: var(--s3); }
.hint-level .hint-head { display: flex; align-items: center; gap: var(--s3); }
.hint-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(230,183,124,0.14); color: var(--amber); font-weight: 700; font-size: 13px; flex: none; }
.hint-level .hint-title { flex: 1 1 auto; font-weight: 600; }
.hint-text { margin-top: var(--s3); color: var(--text); animation: rise-in var(--t-view) var(--ease-out) both; }
/* Aide pas encore accessible : on estompe le cadre et la pastille, jamais le texte (contraste ≥ 4,5:1 sur --surface-2). */
.hint-level.is-locked { border-style: dashed; }
.hint-level.is-locked .hint-num { opacity: .5; }
.hint-level.is-locked .hint-title { color: var(--text-2); }
.hint-level.is-locked .t-meta { color: var(--text-3); }
.hint-level.is-solution .hint-num { background: rgba(141,207,216,0.14); color: var(--blue); }

/* ---------- Offres (boutique) ---------- */
.offer { position: relative; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.offer-head { display: flex; align-items: flex-start; gap: var(--s3); }
.offer-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--amber); flex: none; }
.offer-icon svg { width: 22px; height: 22px; }
.offer-title { font-family: var(--font-serif); font-size: var(--fs-h3); font-weight: 500; line-height: 1.15; }
.offer-kind { font-size: var(--fs-meta); color: var(--text-2); margin-top: 2px; }
.offer-desc { color: var(--text-2); font-size: calc(var(--fs-body) * 0.94); }
.offer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s1); }
.price { font-family: var(--font-serif); font-size: var(--fs-h2); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price small { font-family: var(--font-sans); font-size: var(--fs-meta); color: var(--text-2); font-weight: 500; margin-left: 4px; white-space: nowrap; }
.offer-featured { background: linear-gradient(160deg, rgba(230,183,124,0.14), rgba(20,28,38,0.2) 55%), var(--surface); border-color: rgba(230,183,124,0.4); }
.offer-featured .offer-icon { background: var(--amber); color: var(--amber-ink); }
.offer-list { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: calc(var(--fs-body) * 0.94); }
.offer-list li { display: flex; gap: 8px; align-items: flex-start; }
.offer-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-top: 9px; flex: none; }
.offer.is-owned { border-color: rgba(155,201,174,0.45); }
.plan-row { display: grid; gap: var(--s2); }
.plan { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 60px; padding: 10px 14px; border-radius: var(--r-btn); background: var(--surface-2); border: 1.5px solid transparent; color: var(--text); text-align: left; transition: border-color var(--t-press), background-color var(--t-press); }
.plan[aria-checked="true"] { border-color: var(--amber); background: rgba(230,183,124,0.12); }
.plan .plan-text { flex: 1 1 auto; min-width: 0; }
.plan b { display: block; font-size: var(--fs-ctrl); }
.plan small { display: block; color: var(--text-2); font-size: var(--fs-meta); margin-top: 2px; }
.plan .chip { display: inline-flex; margin-top: 6px; }
.plan .plan-price { flex: none; font-family: var(--font-serif); font-size: var(--fs-h3); font-weight: 600; white-space: nowrap; text-align: right; }
.plan .plan-price small { font-family: var(--font-sans); font-weight: 500; margin-top: 0; }

/* ---------- Cadre interrompu : révélation ---------- */
.frame-reveal { position: absolute; transform: translate(-50%, -50%); pointer-events: none; color: var(--amber); }
.frame-reveal svg { overflow: visible; }
.frame-reveal .fr-path { stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw var(--t-reveal) var(--ease-out) forwards; }
.frame-reveal .fr-light { opacity: 0; animation: light-in var(--t-reveal) var(--ease-out) forwards; animation-delay: calc(var(--t-reveal) * 0.4); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes light-in { from { opacity: 0; transform: translate(6px, -6px); } to { opacity: 1; transform: none; } }
.reveal-in { animation: reveal-in var(--t-reveal) var(--ease-out) both; }
@keyframes reveal-in { from { opacity: 0; transform: scale(0.85); filter: brightness(1.6); } to { opacity: 1; transform: none; filter: none; } }
.trace path { fill: none; stroke: var(--amber); stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: trace-draw var(--t-reveal) var(--ease-out) forwards, trace-fade var(--t-view) var(--ease-in) forwards; animation-delay: 0s, calc(var(--t-reveal) + 200ms); }
@keyframes trace-draw { to { stroke-dashoffset: 0; } }
@keyframes trace-fade { to { opacity: 0; } }

/* Ouverture d'une archive résolue */
.unlock-anim { animation: unlock var(--t-reveal) var(--ease-out) both; }
@keyframes unlock { 0% { transform: none; } 30% { transform: translateY(-4px) scale(1.03); } 100% { transform: none; } }
.success-mark { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(155,201,174,0.16); color: var(--success); }
.success-mark svg { width: 34px; height: 34px; }

/* ---------- Progression ---------- */
.steps { display: flex; gap: 6px; }
.steps span { flex: 1 1 0; height: 4px; border-radius: 2px; background: var(--line-2); }
.steps span.is-done { background: var(--success); }
.steps span.is-current { background: var(--amber); }

/* ---------- Achats intégrés : porte-monnaie d'indices, pochettes, coffret, coup de pouce ---------- */
/* Couleurs d'accent : l'ambre par défaut, l'accent de l'enquête sous #stage[data-theme] (voir la fin de ce bloc). */

/* Coup de pouce : le bouton Aide de la traque s'illumine doucement (trois respirations, puis reste éclairé). */
.btn-label-icon.is-nudge { border-color: rgba(230,183,124,0.8); color: var(--amber-2); background: rgba(28,24,18,0.92); box-shadow: 0 0 0 1px rgba(230,183,124,0.35), 0 0 18px rgba(230,183,124,0.26); animation: nudge-glow 2.6s var(--ease-in-out) 3; }
.btn-label-icon.is-nudge svg { color: var(--amber); }
.btn-label-icon.is-nudge span { white-space: nowrap; }
@keyframes nudge-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(230,183,124,0.35), 0 0 12px rgba(230,183,124,0.16); }
  50% { box-shadow: 0 0 0 1px rgba(230,183,124,0.7), 0 0 30px rgba(230,183,124,0.45); }
}
:root[data-motion="reduced"] .btn-label-icon.is-nudge { animation: none; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .btn-label-icon.is-nudge { animation: none; } }

/* Solde d'indices (feuille d'aides, boutique). */
.wallet-bar, .wallet-line { display: flex; align-items: center; gap: var(--s3); padding: 10px; border-radius: var(--r-btn); background: var(--surface-2); border: 1px solid var(--line-2); }
.wallet-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(230,183,124,0.14); color: var(--amber); flex: none; }
.wallet-ic svg { width: 18px; height: 18px; }
.wallet-text, .wallet-line .grow { color: var(--text-2); font-weight: 600; }
.wallet-bar b, .wallet-line b { font-family: var(--font-serif); font-size: calc(var(--fs-h3) * 1.05); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.wallet-bar.is-unlimited b { font-family: var(--font-sans); font-size: var(--fs-ctrl); }
.wallet-bar.is-empty .wallet-ic { background: rgba(243,238,229,0.08); color: var(--text-2); }
.wallet-add { flex: none; min-height: 40px; padding: 0 12px; border-radius: var(--r-chip); background: rgba(243,238,229,0.06); color: var(--text); }
.wallet-add[aria-expanded="true"] { background: rgba(230,183,124,0.12); }
.wallet-welcome { display: flex; align-items: center; gap: 8px; margin-top: var(--s2); padding: 0 4px; color: var(--amber); font-size: var(--fs-meta); font-weight: 600; }
.wallet-welcome svg { width: 16px; height: 16px; flex: none; }
.hints-rule { margin-top: var(--s3); line-height: 1.45; }
.hints-tabs { margin: var(--s4) 0 var(--s3); }
.hints-sheet > .hint-offers { margin-top: var(--s3); padding: var(--s3); border-radius: var(--r-card); border: 1px dashed var(--line-2); }

/* Coût d'une aide pas encore ouverte. */
.hint-cost { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 9px; border-radius: var(--r-chip); font-size: 12px; font-weight: 700; letter-spacing: 0.01em; background: rgba(243,238,229,0.08); color: var(--text-2); white-space: nowrap; }
.hint-cost svg { width: 12px; height: 12px; color: var(--amber); }
.hint-cost.is-free { background: rgba(155,201,174,0.14); color: var(--success); }
.hint-cost.is-cercle { background: rgba(230,183,124,0.14); color: var(--amber); }
.hint-note { margin-top: var(--s3); color: var(--text-2); font-size: calc(var(--fs-body) * 0.94); line-height: 1.45; }
.hint-offers { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s3); }
.hint-offers .link-btn, .hint-offers .sim-badge { align-self: center; }
.hint-level.is-new { border-color: rgba(230,183,124,0.55); }
.hint-level.is-new .hint-text:focus { outline: none; }

/* Pochettes d'indices : trois tuiles, la pochette de 5 mise en avant, le prix d'un indice sous le prix. */
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); padding-top: 12px; }
.pack { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; min-width: 0; min-height: 128px; padding: 18px 6px 12px; border-radius: var(--r-card); background: var(--surface-2); border: 1.5px solid var(--line-2); color: var(--text); text-align: center; transition: transform var(--t-press) var(--ease-out), border-color var(--t-press), background-color var(--t-press); -webkit-tap-highlight-color: transparent; }
.pack:active { transform: scale(0.97); }
.pack:hover { border-color: rgba(243,238,229,0.32); }
.pack.is-highlight { border-color: var(--amber); background: linear-gradient(180deg, rgba(230,183,124,0.18), rgba(230,183,124,0.04) 70%), var(--surface-2); box-shadow: 0 10px 26px rgba(230,183,124,0.14); }
.pack-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); max-width: calc(100% + 10px); padding: 3px 9px; border-radius: var(--r-chip); background: var(--surface-3); border: 1px solid rgba(230,183,124,0.45); color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.pack.is-highlight .pack-badge { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.pack-qty { font-family: var(--font-serif); font-size: calc(34px * var(--scale)); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.pack-label { font-size: var(--fs-meta); color: var(--text-2); font-weight: 600; }
.pack-price { margin-top: 10px; font-size: var(--fs-ctrl); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pack-unit { font-size: 12px; color: var(--text-3); font-weight: 500; }
.pack.is-highlight .pack-unit { color: var(--amber); }
.pack.is-loading { pointer-events: none; opacity: 0.6; }
/* Texte « Très grand » : une pochette par ligne (quantité à gauche, prix et prix d'un indice à droite), rien de tronqué. */
:root[data-text="xl"] .packs { grid-template-columns: 1fr; gap: var(--s4); }
:root[data-text="xl"] .pack { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "qty label price" "qty label unit"; align-items: center; column-gap: var(--s3); min-height: 0; padding: 30px 16px 14px; text-align: left; }
:root[data-text="xl"] .pack-qty { grid-area: qty; }
:root[data-text="xl"] .pack-label { grid-area: label; }
:root[data-text="xl"] .pack-price { grid-area: price; margin-top: 0; text-align: right; }
:root[data-text="xl"] .pack-unit { grid-area: unit; text-align: right; }
:root[data-text="xl"] .pack-badge { left: 14px; transform: none; font-size: var(--fs-meta); }

/* Offres : surtitre, prix d'ancrage, coffret aux trois couvertures. */
.offer-kicker { font-size: var(--fs-meta); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.anchor { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.price-was { color: var(--text-2); font-size: var(--fs-meta); font-weight: 500; white-space: nowrap; }
.price-was s { text-decoration-thickness: 1.5px; text-decoration-color: rgba(243,238,229,0.55); }
.save-chip { align-self: center; }
.offer-bundle { background: linear-gradient(172deg, rgba(230,183,124,0.12), rgba(20,28,38,0) 58%), var(--surface); border-color: rgba(230,183,124,0.38); }
.cover-stack { display: flex; justify-content: center; align-items: flex-end; padding: 6px 0 4px; }
.cover-tile { position: relative; width: 29%; max-width: 124px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: 0 12px 26px rgba(0,0,0,0.5); }
.cover-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-tile:nth-child(1) { transform: rotate(-6deg) translate(16px, 4px); }
.cover-tile:nth-child(2) { z-index: 1; transform: translateY(-4px); }
.cover-tile:nth-child(3) { transform: rotate(6deg) translate(-16px, 4px); }
.offer.is-owned .cover-stack { opacity: 0.85; }
.cercle-sheet .plan-row { margin-top: var(--s1); }

/* Accent de l'enquête en cours. */
#stage[data-theme] .btn-label-icon.is-nudge { border-color: color-mix(in srgb, var(--amber) 80%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 35%, transparent), 0 0 18px color-mix(in srgb, var(--amber) 26%, transparent); animation-name: nudge-glow-theme; background: color-mix(in srgb, var(--amber) 10%, rgba(9,13,18,0.92)); }
@keyframes nudge-glow-theme {
  0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 35%, transparent), 0 0 12px color-mix(in srgb, var(--amber) 16%, transparent); }
  50% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 70%, transparent), 0 0 30px color-mix(in srgb, var(--amber) 45%, transparent); }
}
#stage[data-theme] .wallet-ic, #stage[data-theme] .hint-cost.is-cercle, #stage[data-theme] .wallet-add[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 14%, transparent); }
#stage[data-theme] .hint-level.is-new { border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
#stage[data-theme] .pack.is-highlight { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 18%, transparent), color-mix(in srgb, var(--amber) 4%, transparent) 70%), var(--surface-2); box-shadow: 0 10px 26px color-mix(in srgb, var(--amber) 14%, transparent); }
#stage[data-theme] .pack-badge { border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
#stage[data-theme] .offer-bundle { background: linear-gradient(172deg, color-mix(in srgb, var(--amber) 12%, transparent), rgba(20,28,38,0) 58%), var(--surface); border-color: color-mix(in srgb, var(--amber) 38%, transparent); }
.hints-tabs .seg { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.hints-tabs .seg svg { width: 14px; height: 14px; color: var(--success); flex: none; }
.hints-puzzle { margin: 0 0 var(--s3); font-family: var(--font-serif); font-size: var(--fs-h3); font-weight: 500; line-height: 1.2; }
#stage[data-theme] .plan[aria-checked="true"] { background: color-mix(in srgb, var(--amber) 12%, transparent); }

/* Liens « Conditions d'utilisation · Politique de confidentialité » sous un bouton d'abonnement (App Store 3.1.2). */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 2px; margin: 0; font-size: var(--fs-meta); color: var(--text-3); }
.legal-links .legal-link { min-height: 32px; font-size: var(--fs-meta); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; color: var(--text-2); }
