/* Les 80 ans de Monique — prune, rose et or, confettis. Pensé d'abord pour le téléphone. */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #fdf7f0;
  --surface: #ffffff;
  --surface-2: #f8ede4;
  --text: #2d1a24;
  --muted: #7b6570;
  --line: #eedfd3;
  --accent: #8a2a55;          /* prune : boutons, liens */
  --accent-ink: #ffffff;
  --accent-soft: #f7e4ec;
  --gold-ink: #8c5f1c;        /* or lisible pour du texte */
  --gold: linear-gradient(135deg, #f8e3a0, #ddae4c 45%, #a26f22);
  --ok: #2f7d55;
  --ok-soft: #e2f3e9;
  --danger: #b8384c;
  /* Une couleur par type de question. */
  --k-qcm: #2f8f84;
  --k-vraifaux: #3b74c9;
  --k-quiz: #b9862a;
  --k-libre: #8b6bc4;
  --k-quiestce: #d1527c;
  --k-ou: #3d9658;
  --k-zoom: #c8642a;
  --k-annee: #8a6440;
  --k-ordre: #5a63c9;
  --k-pause: #c23d4a;
  --shadow: 0 1px 2px rgba(90, 30, 55, .06), 0 10px 28px rgba(90, 30, 55, .08);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --radius: 18px;
  /* Confettis semés derrière la page, à peine visibles. */
  --sprinkles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill-opacity='.35'%3E%3Crect x='20' y='30' width='5' height='12' rx='2' fill='%23e3b44c' transform='rotate(25 22 36)'/%3E%3Ccircle cx='170' cy='40' r='3.5' fill='%23ef8fab'/%3E%3Crect x='110' y='95' width='5' height='12' rx='2' fill='%234fb3a5' transform='rotate(-30 112 101)'/%3E%3Ccircle cx='60' cy='150' r='3' fill='%23a58ad8'/%3E%3Crect x='185' y='160' width='5' height='12' rx='2' fill='%23ef8fab' transform='rotate(60 187 166)'/%3E%3Cpath d='M140 190l3 6 6 1-4.5 4 1 6-5.5-3-5.5 3 1-6-4.5-4 6-1z' fill='%23e3b44c'/%3E%3Ccircle cx='90' cy='20' r='2.5' fill='%23f2a272'/%3E%3Crect x='30' y='95' width='4' height='10' rx='2' fill='%23a58ad8' transform='rotate(-55 32 100)'/%3E%3C/g%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1c1017;
    --surface: #29171f;
    --surface-2: #35202b;
    --text: #f8ebe3;
    --muted: #c3a8b5;
    --line: #48303d;
    --accent: #f29bba;
    --accent-ink: #2a0f1c;
    --accent-soft: #46223a;
    --gold-ink: #ecc56f;
    --ok: #74d3a0;
    --ok-soft: #1e3a2c;
    --danger: #ff8fa0;
    --k-qcm: #6fcabd;
    --k-vraifaux: #7fa9ec;
    --k-quiz: #e7b95a;
    --k-libre: #b9a0ee;
    --k-quiestce: #f08bae;
    --k-ou: #7fd197;
    --k-zoom: #f2a06b;
    --k-annee: #d3ad84;
    --k-ordre: #9aa1f0;
    --k-pause: #f08a93;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(800px 420px at 50% -160px, color-mix(in srgb, #e3b44c 26%, transparent), transparent),
    radial-gradient(600px 380px at 110% 10%, color-mix(in srgb, #ef8fab 18%, transparent), transparent),
    var(--sprinkles),
    var(--bg);
  background-attachment: scroll;
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 15px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- icônes ---------- */
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-play { fill: currentColor; stroke-width: 1.5; }

/* ---------- badge « 80 » ---------- */
.badge80 { display: block; width: 112px; height: 112px; }
.badge80-num { font-family: var(--serif); font-weight: 700; font-size: 50px; font-style: italic; }

/* ---------- boutons et champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px;
  border: 1.5px solid transparent; border-radius: 14px;
  font: inherit; font-weight: 650; color: var(--text); background: none;
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background-color .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, .input:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.link { color: var(--accent); min-height: 44px; }
.btn.danger { color: var(--danger); }
.btn.big { min-height: 60px; font-size: 19px; border-radius: 18px; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn.wide { width: 100%; }

.input {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px;   /* 16 px au moins : Safari ne zoome pas sur le champ */
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:focus { border-color: var(--accent); outline: none; }
textarea.input { resize: vertical; line-height: 1.45; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 18px center, right 13px center; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

.form-error { color: var(--danger); font-weight: 600; font-size: 15px; min-height: 0; }
.form-error:empty { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-title { font-family: var(--serif); font-size: 24px; font-weight: 650; text-align: center; }
.card-title.left { text-align: left; font-size: 21px; }

/* ---------- connexion ---------- */
.login { max-width: 460px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 40px; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 22px; }
.hero .badge80 { width: 124px; height: 124px; margin-bottom: 6px; filter: drop-shadow(0 6px 14px rgba(162, 111, 34, .25)); }
.hero-title { font-family: var(--serif); font-weight: 700; font-size: 38px; line-height: 1.05; letter-spacing: -.01em; }
.hero-title span {
  font-size: 44px;
  background: linear-gradient(120deg, var(--accent), #c9577f 60%, #d79a3a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin-top: 8px; color: var(--muted); font-size: 16px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }

.login-card { display: flex; flex-direction: column; gap: 14px; }
.who-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px; }
.who {
  display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 650; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.who:active { transform: scale(.97); border-color: var(--accent); }
.who-emoji { font-size: 26px; line-height: 1; }
.who-name { overflow-wrap: anywhere; }

.back-link { align-self: flex-start; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 6px 0; cursor: pointer; }

.pin-dots { display: flex; justify-content: center; gap: 18px; margin: 6px 0 2px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent); transition: background-color .12s ease, transform .12s ease; }
.pin-dots span.on { background: var(--accent); transform: scale(1.08); }
.pin-error { color: var(--danger); text-align: center; font-weight: 600; min-height: 24px; font-size: 15px; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; width: 100%; margin: 0 auto; }
.keypad button {
  aspect-ratio: 1.25; border: 0; border-radius: 20px;
  background: var(--surface-2); color: var(--text);
  font-family: var(--serif); font-size: 30px; font-weight: 600;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background-color .12s ease;
}
.keypad button:active { transform: scale(.93); background: var(--accent-soft); }
.keypad button[data-key="del"] { background: none; display: grid; place-items: center; font-size: 30px; color: var(--muted); }
.keypad button[data-key="del"] .icon { stroke-width: 1.8; }

/* Pendant la saisie du code, l'en-tête rétrécit : le clavier tient sur l'écran. */
.typing-pin .login { padding-top: max(14px, env(safe-area-inset-top)); }
.typing-pin .hero { flex-direction: row; justify-content: center; gap: 10px; margin-bottom: 14px; }
.typing-pin .hero .badge80 { width: 56px; height: 56px; margin: 0; }
.typing-pin .hero-title { font-size: 22px; text-align: left; }
.typing-pin .hero-title br { display: none; }
.typing-pin .hero-title span { font-size: 22px; }
.typing-pin .hero-sub { display: none; }
.typing-pin .login-card { gap: 10px; }
.typing-pin .keypad button { aspect-ratio: 1.45; }
.keypad.busy { opacity: .5; pointer-events: none; }

.shake { animation: shake .4s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}
.login-help { text-align: center; color: var(--muted); font-size: 15px; margin-top: 18px; }

/* ---------- barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; min-width: 0; }
.brand .badge80 { width: 40px; height: 40px; flex: none; }
.brand span { font-family: var(--serif); font-weight: 650; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-chip {
  flex: none; display: flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 650; cursor: pointer;
}

/* ---------- pages ---------- */
.page { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }
.page.wide { max-width: 980px; }

.welcome { position: relative; overflow: hidden; }
.welcome::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%;
  background: var(--gold); opacity: .18;
}
.welcome-title { font-family: var(--serif); font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.welcome-text { white-space: pre-line; color: var(--text); }
.closed-note { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-weight: 600; }

.add-btn .icon { font-size: 24px; stroke-width: 2.6; }

.section-title { font-family: var(--serif); font-size: 22px; font-weight: 650; margin: 4px 2px 10px; }
.section-title .count { color: var(--muted); font-weight: 500; }
.empty { text-align: center; color: var(--muted); line-height: 1.6; }
.privacy { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.55; padding: 0 8px; }

/* ---------- cartes de question ---------- */
.q-list { display: flex; flex-direction: column; gap: 14px; }
.q-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px 20px;
  display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
}
.q-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--kind, var(--accent)); }
.kind-qcm { --kind: var(--k-qcm); }
.kind-vraifaux { --kind: var(--k-vraifaux); }
.kind-quiz { --kind: var(--k-quiz); }
.kind-libre { --kind: var(--k-libre); }
.kind-quiestce { --kind: var(--k-quiestce); }
.kind-ou { --kind: var(--k-ou); }
.kind-zoom { --kind: var(--k-zoom); }
.kind-annee { --kind: var(--k-annee); }
.kind-ordre { --kind: var(--k-ordre); }
.kind-pause { --kind: var(--k-pause); }
.q-card.clickable { cursor: pointer; transition: transform .12s ease; }
.q-card.clickable:active { transform: scale(.985); }
.q-card-top { display: flex; align-items: center; gap: 8px; }
.kind-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 4px; border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  color: var(--kind); background: color-mix(in srgb, var(--kind) 13%, transparent);
}
.kind-badge b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: color-mix(in srgb, var(--kind) 22%, var(--surface)); font-size: 13px; }
.q-edit { margin-left: auto; color: var(--muted); font-size: 18px; display: grid; }
.q-prompt { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.3; white-space: pre-line; overflow-wrap: anywhere; }
.choices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.choices li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); overflow-wrap: anywhere; }
.choices li.correct { background: var(--ok-soft); font-weight: 650; }
.choice-mark { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); font-size: 14px; }
.choice-mark .icon { stroke-width: 3.2; }
.correct .choice-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.answer { padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.answer-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ok); font-weight: 800; }
.q-note { font-family: var(--serif); font-style: italic; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.thumbs.ranked { counter-reset: rank; }
.thumbs.ranked .thumb::after {
  counter-increment: rank; content: counter(rank);
  position: absolute; left: 6px; top: 6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); color: #3a2506; font-weight: 800; font-size: 13px;
}
.zoom-card { display: flex; align-items: center; gap: 12px; }
.zoom-card .zoom-view { width: 84px; border-radius: 12px; flex: none; }
.zoom-view { position: relative; overflow: hidden; background: var(--surface-2); max-height: 260px; }
.zoom-view img { display: block; width: 100%; height: 100%; object-fit: cover; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb {
  position: relative; width: 84px; height: 84px; padding: 0; border: 0; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-play {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; background: rgba(0, 0, 0, .28); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
}
.thumb-play small { font-size: 12px; font-weight: 700; }

/* ---------- éditeur ---------- */
.editor { display: flex; flex-direction: column; gap: 22px; }
.editor-bar { margin-bottom: -10px; }
.editor-title { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.editor-rest { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 10px; }
.field-label { font-family: var(--serif); font-size: 20px; font-weight: 650; }
.hint { color: var(--muted); font-size: 15px; margin-top: -4px; }

.kind-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kind-group { grid-column: 1 / -1; margin: 6px 2px -2px; color: var(--muted); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kind-group:first-child { margin-top: 0; }
.kind-option {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px; min-height: 62px;
  border: 2px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; line-height: 1.2; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, background-color .15s ease, transform .1s ease;
}
.kind-option:active { transform: scale(.97); }
.kind-option[aria-checked="true"] { border-color: var(--kind); background: color-mix(in srgb, var(--kind) 12%, var(--surface)); }
.kind-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: color-mix(in srgb, var(--kind) 20%, var(--surface)); font-size: 22px;
}
.kind-option[aria-checked="true"] .kind-icon { background: var(--kind); }
.kind-chosen { display: flex; align-items: center; gap: 10px; }
.kind-chosen .kind-option { flex: 1; cursor: default; }
.kind-hint { color: var(--muted); font-size: 15px; font-weight: 600; }
.change-media { align-self: flex-start; min-height: 36px; padding: 0; }
.kind-hint:empty { display: none; }

.choice-rows { display: flex; flex-direction: column; gap: 8px; }
.choice-row { display: grid; grid-template-columns: 46px 1fr 40px; align-items: center; gap: 6px; }
.choice-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2.5px solid var(--line); background: var(--surface);
  display: grid; place-items: center;
  color: #fff; font-size: 22px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.choice-toggle .icon { stroke-width: 3.2; }
.choice-toggle.on { background: var(--ok); border-color: var(--ok); }
.choice-row.correct .input { border-color: var(--ok); background: var(--ok-soft); font-weight: 600; }
.choice-remove { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.choice-remove:disabled { opacity: .3; cursor: default; }
.add-choice { align-self: flex-start; }

.truth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.truth {
  min-height: 60px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 20px; font-weight: 750; cursor: pointer;
}
.truth-vrai[aria-checked="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.truth-faux[aria-checked="true"] { background: var(--danger); border-color: var(--danger); color: #fff; }
.year-input { max-width: 160px; font-size: 22px; font-weight: 700; letter-spacing: .08em; }

.tile-rank {
  position: absolute; left: 6px; top: 6px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); color: #3a2506; font-weight: 800; pointer-events: none;
}
.tile-move { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 4px; }
.tile-move button {
  display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 16px; cursor: pointer;
}
.tile-move button:disabled { visibility: hidden; }

.media-special { display: flex; flex-direction: column; gap: 10px; }
.media-special:empty { display: none; }
.zoom-pick { display: grid; grid-template-columns: 1fr 110px; gap: 12px; align-items: start; }
.zoom-frame { position: relative; border-radius: 14px; overflow: hidden; cursor: crosshair; line-height: 0; }
.zoom-frame img { width: 100%; display: block; }
.zoom-dot {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0, 0, 0, .4); pointer-events: none;
}
.zoom-side { display: flex; flex-direction: column; gap: 6px; text-align: center; }
.zoom-preview .zoom-view { border-radius: 12px; border: 2px solid var(--accent); }
.media-special video { width: 100%; max-height: 360px; border-radius: 14px; background: #000; }
.pause-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pause-moment { color: var(--muted); font-weight: 600; }
.pause-moment.set { color: var(--ok); font-weight: 800; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.media-tile { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.media-tile .thumb { width: 100%; height: 100%; border-radius: 0; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile.uploading img { opacity: .5; }
.tile-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; }
.tile-label { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 13px; font-weight: 700; }
.progress { position: absolute; left: 10px; right: 10px; bottom: 8px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 15%, transparent); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.tile-remove {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 15px; cursor: pointer;
}
.media-add {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 14px;
  background: color-mix(in srgb, var(--accent-soft) 50%, transparent); color: var(--accent);
  font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; padding: 6px; text-align: center;
}
.media-add-icon { font-size: 30px; line-height: 0; }
.media-grid.empty { grid-template-columns: 1fr; }
.media-grid.empty .media-add { aspect-ratio: auto; min-height: 96px; flex-direction: row; gap: 10px; font-size: 16px; }

.editor-actions {
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 -16px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* ---------- fenêtres ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(28, 8, 18, .5);
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  animation: rise .22s ease;
}
.sheet-title { font-family: var(--serif); font-size: 23px; font-weight: 700; text-align: center; }
.field-label + .input { margin-top: -2px; }
.pin-input { text-align: center; letter-spacing: .3em; font-size: 20px; }
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 24px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 80;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 650; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transition: transform .25s ease, opacity .25s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.success { background: var(--ok); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

.confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 9px; height: 15px; border-radius: 2px;
  animation: fall linear forwards;
}
.confetti i.round { width: 10px; height: 10px; border-radius: 50%; }
@keyframes fall {
  to { transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin)); }
}

.lightbox {
  position: fixed; inset: 0; z-index: 70; background: rgba(10, 4, 8, .94);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 8px calc(48px + env(safe-area-inset-bottom)); }
.lightbox-stage img, .lightbox-stage video { max-width: 100%; max-height: 100%; border-radius: 6px; }
.lightbox-close, .lightbox-nav {
  position: absolute; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer;
}
.lightbox-close, .lightbox-nav { display: grid; place-items: center; }
.lightbox-close { top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; font-size: 20px; }
.lightbox-nav { top: 50%; width: 46px; height: 46px; margin-top: -23px; font-size: 26px; }
.lightbox-nav.prev { left: 8px; }
.lightbox-nav.next { right: 8px; }
.lightbox-count { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); color: #fff; font-weight: 600; font-size: 14px; }

/* ---------- organisateur ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  display: flex; flex-direction: column; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.stat strong { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--gold-ink); }
.stat span { color: var(--muted); font-size: 14px; }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); }
.tabs button {
  flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: none; color: var(--muted);
  font: inherit; font-weight: 700; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab-panel { display: flex; flex-direction: column; gap: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.filters .select { width: auto; min-width: 200px; flex: 1 1 200px; max-width: 320px; }
.order-hint { margin-top: -4px; }

.q-author { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.rank {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px;
  background: var(--gold); color: #3a2506; font-family: var(--serif); font-weight: 800; font-size: 16px; margin-right: 4px;
}
.q-admin { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.segmented button { min-height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.segmented .seg-nouvelle[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented .seg-retenue[aria-checked="true"] { background: var(--ok); color: #fff; }
.segmented .seg-ecartee[aria-checked="true"] { background: var(--muted); color: var(--surface); }
.admin-note { font-size: 15px; padding: 10px 12px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.q-card.status-retenue { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.q-card.status-ecartee > :not(.q-admin) { opacity: .55; }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-option {
  width: 46px; height: 46px; border-radius: 12px; border: 2px solid transparent;
  background: var(--surface-2); font-size: 24px; cursor: pointer;
}
.emoji-option[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }

.member-list { display: flex; flex-direction: column; gap: 10px; }
.member { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; }
.member-emoji { font-size: 32px; line-height: 1; }
.member-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.member-main strong { font-size: 18px; }
.state-badge { align-self: flex-start; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); font-size: 13px; font-weight: 700; }
.member-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.pin-big { text-align: center; font-family: var(--serif); font-size: 58px; font-weight: 700; letter-spacing: .18em; color: var(--gold-ink); line-height: 1.1; }
.share-preview { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; color: var(--muted); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.site-url { font-weight: 650; overflow-wrap: anywhere; }

/* ---------- tuto de la première connexion ---------- */
.tuto {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 70%, rgba(45, 10, 30, .55));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade .2s ease;
}
.tuto-card {
  position: relative; width: 100%; max-width: 400px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: 34px 22px 22px; border-radius: 28px;
  background: var(--surface); box-shadow: 0 24px 60px rgba(60, 10, 35, .3);
}
.tuto-card.turn > :not(.tuto-skip) { animation: rise .25s ease; }
.tuto-skip { position: absolute; top: 12px; right: 14px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; font-weight: 600; padding: 6px; cursor: pointer; }
.tuto-art {
  display: grid; place-items: center; width: 132px; height: 132px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff6d8, #f6dfa0 55%, #e2b85a);
  font-size: 64px; box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .5);
}
.tuto-types { display: grid; grid-template-columns: repeat(2, 40px); gap: 8px; }
.tuto-types .kind-icon { background: var(--kind); }
.tuto-title { font-family: var(--serif); font-size: 26px; font-weight: 700; margin-top: 6px; }
.tuto-text { color: var(--muted); font-size: 17px; max-width: 300px; }
.tuto-dots { display: flex; gap: 8px; margin: 6px 0 4px; }
.tuto-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: width .2s ease, background-color .2s ease; }
.tuto-dots i.on { width: 22px; border-radius: 4px; background: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
