/* Ouvre quand… — papier, encre et cire */
:root {
  --ink: #2a211c;
  --ink-2: #5b4d43;
  --ink-3: #8a7a6c;
  --paper: #f4ecdf;
  --paper-2: #ebe0cf;
  --paper-3: #dccdb6;
  --night: #1b1512;
  --night-2: #261e19;
  --wax: #9b2c26;
  --wax-hi: #c2453c;
  --wax-lo: #6e1c18;
  --ok: #3f6b45;
  --warn: #a5651b;
  --radius: 14px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Script", cursive;
}
[data-color="rouge"] { --wax: #9b2c26; --wax-hi: #c2453c; --wax-lo: #6e1c18; }
[data-color="bleu"]  { --wax: #2c4a7a; --wax-hi: #4769a3; --wax-lo: #1b3052; }
[data-color="vert"]  { --wax: #36603d; --wax-hi: #4f8357; --wax-lo: #213d26; }
[data-color="or"]    { --wax: #a87a22; --wax-hi: #cfa046; --wax-lo: #6f4f13; }
[data-color="prune"] { --wax: #5e2c57; --wax-hi: #844079; --wax-lo: #3d1a38; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper); line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--wax-hi); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* grain papier */
.grain::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .2 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid var(--paper-3); background: #fffaf2; border-radius: 999px; padding: .62em 1.15em;
  font-weight: 600; font-size: .95rem; transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-wax { background: var(--wax); border-color: var(--wax-lo); color: #fff6ec; box-shadow: 0 2px 0 var(--wax-lo), 0 8px 18px -8px var(--wax); }
.btn-wax:hover { background: var(--wax-hi); border-color: var(--wax-lo); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(42,33,28,.06); border-color: transparent; }
.btn-danger { color: var(--wax); }
.btn-sm { padding: .4em .8em; font-size: .85rem; }
.icon { width: 1.1em; height: 1.1em; flex: none; }

/* cachet de cire */
.seal {
  --s: 92px; width: var(--s); height: var(--s); border-radius: 50%; position: relative; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--wax-hi), var(--wax) 45%, var(--wax-lo) 100%);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,.35), inset 0 4px 6px rgba(255,255,255,.18), 0 6px 14px -4px rgba(0,0,0,.45);
  color: rgba(255,240,225,.82); font-family: var(--serif); font-style: italic; font-size: calc(var(--s) * .42); line-height: 1;
}
.seal::before { /* bavure de cire */
  content: ""; position: absolute; inset: -7%; border-radius: 47% 53% 49% 51% / 52% 46% 54% 48%; z-index: -1;
  background: var(--wax-lo); filter: blur(.3px);
}
.seal::after { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 1.5px solid rgba(255,230,210,.28); }

/* lecteur */
.player { display: flex; align-items: center; gap: 14px; }
.play {
  width: 64px; height: 64px; border-radius: 50%; border: 0; flex: none; display: grid; place-items: center; position: relative;
  background: var(--ink); color: var(--paper); box-shadow: 0 8px 20px -8px rgba(0,0,0,.5);
}
.play svg { width: 26px; height: 26px; }
.play .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.play .ring circle { fill: none; stroke: var(--wax); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
.wave { flex: 1; height: 54px; display: flex; align-items: center; gap: 2px; cursor: pointer; touch-action: none; min-width: 0; }
.wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--paper-3); transition: background .1s; }
.wave i.on { background: var(--ink); }
.times { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--ink-3); display: flex; justify-content: space-between; margin-top: 4px; }

/* champs */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
.input, .textarea {
  width: 100%; border: 1px solid var(--paper-3); background: #fffaf2; border-radius: 10px; padding: .65em .8em; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(155,44,38,.12); }
.textarea { min-height: 90px; resize: vertical; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: .7em 1.1em; border-radius: 12px; font-size: .92rem; transition: .25s; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
