[hidden] { display: none !important; }

:root {
    --bg: #f6f5ff;
    --surface: #ffffff;
    --text: #1b1d36;
    --muted: #6a6f8c;
    --line: #e7e6f5;
    --primary: #6d5dfc;
    --primary-600: #5748e6;
    --primary-50: #efedff;
    --accent: #c147e9;
    --danger: #e0415a;
    --danger-50: #fdecef;
    --ok: #0f9d74;
    --ok-50: #e4f7f0;
    --gradient: linear-gradient(135deg, #6d5dfc 0%, #c147e9 100%);
    --radius: 18px;
    --shadow: 0 1px 2px rgba(27, 29, 54, .04), 0 8px 24px rgba(79, 70, 229, .07);
    --shadow-lg: 0 2px 4px rgba(27, 29, 54, .05), 0 20px 50px rgba(79, 70, 229, .14);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    line-height: 1.55;
    background:
        radial-gradient(900px 500px at 8% -10%, rgba(109, 93, 252, .14), transparent 60%),
        radial-gradient(800px 480px at 100% 0%, rgba(193, 71, 233, .12), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--primary-600); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
small { font-size: .82rem; }
:focus-visible { outline: 3px solid rgba(109, 93, 252, .45); outline-offset: 2px; }

/* ---------- Mise en page ---------- */
.wrap { max-width: 800px; margin: 0 auto; padding: 20px 20px 80px; }
.wrap.wide { max-width: 1120px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row.center { align-items: center; }
.row > .grow { flex: 1 1 220px; }

/* ---------- Navigation ---------- */
.nav {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 0 28px;
}
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; color: var(--text); text-decoration: none;
}
.brand-mark {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
    background: var(--gradient); color: #fff; font-size: 1.1rem; box-shadow: 0 6px 16px rgba(109, 93, 252, .35);
}
.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-links a { text-decoration: none; font-weight: 600; font-size: .94rem; color: var(--text); padding: 8px 12px; border-radius: 10px; }
.nav-links a:hover { background: var(--primary-50); color: var(--primary-600); }
.nav-user { font-size: .85rem; color: var(--muted); padding: 0 6px; }

/* ---------- Cartes ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card h2 .step {
    display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 8px;
    border-radius: 50%; background: var(--primary-50); color: var(--primary-600); font-size: .85rem;
}
.card-narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card-icon {
    display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
    background: var(--primary-50); font-size: 1.5rem; margin-bottom: 16px;
}

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea {
    width: 100%; padding: 12px 14px; font: inherit; color: inherit; background: #fff;
    border: 1.5px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #a3a7bf; }
input:hover { border-color: #d3d1ee; }
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(109, 93, 252, .15); }
input[readonly] { background: #faf9ff; color: var(--muted); }
.field { margin-bottom: 16px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 20px; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
    border: 0; border-radius: 12px; background: var(--gradient); color: #fff; text-decoration: none;
    box-shadow: 0 6px 16px rgba(109, 93, 252, .3); transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(109, 93, 252, .36); filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: var(--primary-50); color: var(--primary-600); box-shadow: none; }
.btn.secondary:hover { background: #e3e0ff; color: var(--primary-600); box-shadow: none; }
.btn.danger { background: var(--danger-50); color: var(--danger); box-shadow: none; }
.btn.danger:hover { background: #fbdbe1; color: var(--danger); box-shadow: none; }
.btn.small { padding: 7px 13px; font-size: .85rem; border-radius: 10px; }
.btn.large { padding: 14px 28px; font-size: 1.05rem; border-radius: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Messages ---------- */
.error, .flash, .notice {
    padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: .94rem; font-weight: 500;
}
.error { background: var(--danger-50); color: #b42a41; }
.flash { background: var(--ok-50); color: #0a7a59; }
.notice { background: var(--primary-50); color: var(--primary-600); word-break: break-all; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.open { background: var(--ok-50); color: var(--ok); }
.badge.closed { background: var(--danger-50); color: var(--danger); }

/* ---------- Statistiques ---------- */
.stats { display: flex; gap: 12px; margin: 16px 0 0; flex-wrap: wrap; }
.stat { background: #faf9ff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; min-width: 110px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; letter-spacing: -.02em; }
.stat span { font-size: .8rem; color: var(--muted); }

/* ---------- Accueil ---------- */
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); max-width: 14ch; margin: 0 auto 16px; }
.hero h1 em { font-style: normal; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 52ch; margin: 0 auto 28px; }
.hero .row { justify-content: center; }
.cloud-art {
    position: relative; margin: 40px auto 8px; max-width: 640px; min-height: 230px;
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 14px;
    padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-lg);
}
.cloud-art span { font-weight: 800; line-height: 1.05; letter-spacing: -.02em; animation: float 6s ease-in-out infinite; }
.cloud-art span:nth-child(2n) { animation-delay: -2s; }
.cloud-art span:nth-child(3n) { animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-5px); } }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-top: 40px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.feature .ico { font-size: 1.5rem; margin-bottom: 8px; }
.feature h3 { margin-bottom: 4px; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- Partage ---------- */
.share { display: flex; gap: 8px; margin-bottom: 12px; }
.share input { flex: 1; font-size: .9rem; }
.share-grid { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; }
#qr { background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 16px; }
#qr svg, #qr img { display: block; width: 140px; height: 140px; }
@media (max-width: 600px) { .share-grid { grid-template-columns: 1fr; } #qr { justify-self: start; } }

/* ---------- Liste des questions ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.grid .card { margin-bottom: 0; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.grid .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.grid .card .actions-bar { margin-top: auto; padding-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.grid form, .actions-bar form { display: inline; }
.q-row { margin-bottom: 10px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .big { font-size: 2.4rem; }

/* ---------- Tableau de modération ---------- */
table { width: 100%; border-collapse: collapse; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
td, th { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: left; }
tbody tr:hover { background: #faf9ff; }
tr.hidden-word td:first-child { text-decoration: line-through; color: var(--muted); }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
.count-pill { display: inline-block; min-width: 28px; text-align: center; padding: 1px 9px; border-radius: 99px; background: var(--primary-50); color: var(--primary-600); font-weight: 700; font-size: .85rem; }
.preview { height: 340px; background: linear-gradient(180deg, #fff, #faf9ff); border: 1px solid var(--line); border-radius: 16px; }
.back-link { display: inline-block; margin-bottom: 14px; font-weight: 600; text-decoration: none; }

/* ---------- Page participant ---------- */
body.participant-page { background: var(--gradient); background-attachment: fixed; }
.participant { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.participant .card { width: 100%; max-width: 580px; padding: 34px 30px; box-shadow: var(--shadow-lg); border: 0; border-radius: 26px; }
.participant .tag { display: inline-block; margin-bottom: 14px; padding: 4px 12px; border-radius: 99px; background: var(--primary-50); color: var(--primary-600); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.participant h1 { font-size: clamp(1.5rem, 5vw, 2rem); margin-bottom: 8px; }
.participant input[type=text] { padding: 15px 16px; font-size: 1.05rem; }
.participant .btn { padding: 15px 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.chip {
    background: var(--primary-50); color: var(--primary-600); border-radius: 99px; padding: 7px 8px 7px 15px;
    font-weight: 700; display: inline-flex; gap: 6px; align-items: center; animation: pop .25s ease-out;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.chip button { background: rgba(109, 93, 252, .12); border: 0; cursor: pointer; color: inherit; width: 22px; height: 22px; border-radius: 50%; font-size: 1rem; line-height: 1; padding: 0; }
.chip button:hover { background: rgba(224, 65, 90, .15); color: var(--danger); }
.hint { min-height: 1.5em; margin: 10px 0 0; font-size: .9rem; }
.hint.err { color: var(--danger); font-weight: 600; }

/* ---------- Écran de projection ---------- */
body.display {
    overflow: hidden;
    background:
        radial-gradient(900px 600px at 0% 0%, rgba(109, 93, 252, .1), transparent 60%),
        radial-gradient(900px 600px at 100% 100%, rgba(193, 71, 233, .1), transparent 60%),
        #fff;
}
.display .head {
    position: fixed; top: 0; left: 0; right: 0; padding: 22px 32px 38px; z-index: 2;
    display: flex; justify-content: space-between; align-items: center; gap: 24px;
    background: linear-gradient(#fff 55%, rgba(255, 255, 255, 0));
}
.display h1 { font-size: clamp(1.5rem, 3.2vw, 2.8rem); margin: 0; }
.display .join {
    text-align: right; color: var(--muted); font-size: clamp(.9rem, 1.4vw, 1.25rem); white-space: nowrap;
    background: var(--primary-50); padding: 10px 18px; border-radius: 14px;
}
.display .join b { color: var(--primary-600); }
.display #cloud { position: fixed; inset: 0; }
.display #cloud svg { width: 100%; height: 100%; }
.display .empty { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 1.5rem; font-weight: 600; text-align: center; }
.display .empty .big { font-size: 3.4rem; }
.display .foot { position: fixed; bottom: 18px; left: 24px; z-index: 2; color: var(--muted); font-weight: 600; background: rgba(255, 255, 255, .85); padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); }
.display .qrbox { position: fixed; bottom: 18px; right: 22px; z-index: 2; background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.display .qrbox svg { display: block; width: 116px; height: 116px; }
svg text.w { transition: opacity .6s; }

@media (max-width: 640px) {
    .wrap { padding: 12px 14px 60px; }
    .card { padding: 20px; }
    .grid { grid-template-columns: 1fr; }
    .nav-user { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.display #qr { padding: 10px; border-radius: 16px; }
.display #qr svg { width: 116px; height: 116px; }

/* Bouton d'actualisation automatique + équipe */
.toggle { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted); background: #fff; border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: #c4c7da; }
.toggle.on { color: var(--ok); border-color: #bfe8da; background: var(--ok-50); }
.toggle.on .dot { background: var(--ok); }
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: #eef0f6; color: var(--muted); }
.role-badge.staff { background: #e5f1ff; color: #1a6fc4; }
.role-badge.admin { background: var(--primary-50); color: var(--primary-600); }
.owner-tag { font-size: .8rem; color: var(--muted); margin: -4px 0 8px; }
td select { font: inherit; padding: 6px 8px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; }
@media (max-width: 640px) { .toggle .label { display: none; } }
