/* Calendrier de l'Avent de la douleur — styles (aucune ressource externe). */
:root {
  --green: #0f4a36;
  --green-2: #1b6b4d;
  --red: #b3202a;
  --red-2: #8f1820;
  --gold: #e3b23c;
  --gold-soft: #fbf1d3;
  --snow: #ffffff;
  --paper: #fbf8f2;
  --ink: #22302a;
  --muted: #5b6a63;
  --line: #e2dccd;
  --ok: #1d7a4a;
  --ok-bg: #e6f4ec;
  --bad: #b3202a;
  --bad-bg: #fbe8e9;
  --warn-bg: #fff3d6;
  --info-bg: #e8f1f8;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 74, 54, .12);
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.55;
  background-image: radial-gradient(circle at 20px 20px, rgba(15, 74, 54, .05) 2px, transparent 3px);
  background-size: 40px 40px;
}
a { color: var(--red-2); }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid #1c5fd1; outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
.wrap.narrow { max-width: 760px; }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 1rem 0 .5rem; color: var(--green); }
h2 { font-size: 1.3rem; margin: 1.4rem 0 .5rem; color: var(--green); }
h3 { font-size: 1.1rem; margin: 0 0 .3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading, .empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* En-tête */
.site-header { background: linear-gradient(135deg, var(--green) 0%, var(--green-2) 100%); color: #fff; border-bottom: 5px solid var(--red); position: relative; z-index: 2; }
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px; background: repeating-linear-gradient(90deg, var(--red) 0 24px, var(--gold) 24px 36px, var(--snow) 36px 48px); }
.header-inner { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; padding-top: .7rem; padding-bottom: .7rem; }
.brand { display: flex; gap: .6rem; align-items: center; color: #fff; text-decoration: none; margin-right: auto; }
.brand-icon { font-size: 2rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { opacity: .85; }
.nav { display: flex; flex-wrap: wrap; gap: .3rem; }
.nav-link { color: #fff; text-decoration: none; padding: .35rem .7rem; border-radius: 999px; font-size: .95rem; }
.nav-link:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.nav-link[aria-current="page"] { background: #fff; color: var(--green); font-weight: 600; }
.who { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.who-cat { background: rgba(255, 255, 255, .18); padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; }

/* Boutons */
.btn { display: inline-block; font: inherit; font-weight: 600; padding: .55rem 1.1rem; border-radius: 999px; border: 2px solid var(--green); background: #fff; color: var(--green); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--gold-soft); color: var(--green); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-2); border-color: var(--red-2); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn-ghost:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.btn-small { padding: .25rem .8rem; font-size: .85rem; }
.btn-big { padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn-danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.cta { margin: 1rem 0; display: flex; gap: .6rem; flex-wrap: wrap; }

/* Bandeaux et alertes */
.banner { padding: .5rem 1rem; text-align: center; font-size: .95rem; }
.banner-warn { background: var(--warn-bg); border-bottom: 1px solid var(--gold); }
.banner-info { background: var(--info-bg); }
.alert { padding: .7rem 1rem; border-radius: 10px; margin: .8rem 0; }
.alert-error { background: var(--bad-bg); border: 1px solid var(--bad); color: #6c0f16; }
.alert-ok { background: var(--ok-bg); border: 1px solid var(--ok); color: #0e4a2b; }
.notice { padding: .6rem .9rem; border-radius: 10px; margin: .7rem 0; border-left: 5px solid; }
.notice-points { background: var(--gold-soft); border-color: var(--gold); }
.notice-nopoints { background: #eef1f0; border-color: #9aa8a1; }
.notice-info { background: var(--info-bg); border-color: #4a89b8; }

/* Hero */
.hero { padding: 1.2rem 0 .4rem; }
.hero .lead { font-size: 1.1rem; max-width: 52rem; }
.hero-kicker { margin: 0 0 .2rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .85rem; color: var(--red); }
.hero .prize { padding: .7rem 1rem; background: var(--gold-soft); border-left: 5px solid var(--gold); border-radius: 10px; }
.hero .opening { max-width: 52rem; margin-top: 1rem; }

/* Calendrier */
.case-row { margin: 1.2rem 0 1.6rem; }
.case-row h2 { margin-bottom: .2rem; }
.case-summary { margin: 0 0 .6rem; }
.doors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.door { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; min-height: 150px; height: 100%; padding: .5rem .4rem .6rem; border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--snow); border: 3px solid var(--line); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
a.door:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(15, 74, 54, .22); }
.door-num { font-weight: 800; font-size: 1.7rem; line-height: 1; color: var(--green); }
.door-icon { font-size: 1.5rem; margin: .15rem 0; }
.door-title { font-size: .8rem; font-weight: 600; line-height: 1.2; margin-bottom: .2rem; }
.door-label { font-size: .75rem; color: var(--muted); line-height: 1.2; margin-top: auto; }
.door-points { border-color: var(--gold); background: linear-gradient(180deg, #fff, var(--gold-soft)); }
.door-points .door-label { color: #7a5a00; font-weight: 600; }
.door-nopoints { border-color: #b6c2bb; background: #f3f6f4; }
.door-done { border-color: var(--ok); background: var(--ok-bg); }
.door-done .door-label { color: var(--ok); font-weight: 700; }
.door-locked { background: repeating-linear-gradient(45deg, #ece7da, #ece7da 8px, #f3efe4 8px, #f3efe4 16px); border-style: dashed; color: #8a8a7c; box-shadow: none; justify-content: center; }
.door-locked .door-num { color: #7e8c85; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: 1rem 0 2rem; font-size: .9rem; color: var(--muted); }
.chip { display: inline-block; min-width: 1.8rem; text-align: center; padding: .1rem .3rem; border-radius: 8px; border: 2px solid var(--line); }
.chip-points { border-color: var(--gold); background: var(--gold-soft); }
.chip-done { border-color: var(--ok); background: var(--ok-bg); }
.chip-nopoints { background: #f3f6f4; }

/* Page d'une case */
.crumb { margin: 1rem 0 0; }
.day-badge { background: var(--red); color: #fff; border-radius: 10px; padding: .05rem .6rem; font-size: 1.1rem; vertical-align: middle; }
.episodes { list-style: none; display: flex; gap: .4rem; padding: 0; margin: .6rem 0 1rem; }
.episodes li a, .episodes li span { display: inline-flex; width: 2.2rem; height: 2.2rem; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid var(--line); background: #fff; text-decoration: none; font-weight: 700; }
.episodes li.on a { background: var(--green); color: #fff; border-color: var(--green); }
.story { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--green-2); border-radius: var(--radius); padding: .6rem 1.2rem; box-shadow: var(--shadow); font-size: 1.05rem; }
.question-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1.2rem 1.2rem; margin: 1.2rem 0 3rem; box-shadow: var(--shadow); }
.rules-short { padding-left: 1.2rem; color: var(--muted); font-size: .95rem; }
.stem { font-size: 1.1rem; font-weight: 600; margin: 1rem 0 .4rem; }
.timer { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; background: var(--green); color: #fff; padding: .5rem 1rem; border-radius: 12px; position: sticky; top: .4rem; z-index: 5; }
.timer-time { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-info { font-size: .85rem; opacity: .95; }
.options { border: 0; padding: 0; margin: .6rem 0; display: grid; gap: .6rem; }
.option { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .9rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.option:hover { border-color: var(--green-2); background: #f6fbf8; }
.option input { width: 1.3rem; height: 1.3rem; margin-top: .15rem; flex: none; accent-color: var(--red); }
.option:has(input:checked) { border-color: var(--red); background: #fff4f4; }
.option-letter { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--green); color: #fff; text-align: center; line-height: 1.7rem; font-weight: 700; font-size: .9rem; }

/* Correction */
.score-box { border-radius: 12px; padding: .8rem 1rem; margin: .6rem 0; border: 2px solid; }
.score-box.perfect { background: var(--ok-bg); border-color: var(--ok); }
.score-box.partial { background: var(--gold-soft); border-color: var(--gold); }
.score-box.noscore { background: #eef1f0; border-color: #9aa8a1; }
.score-big { font-size: 1.3rem; }
.score-detail { font-size: .92rem; color: var(--muted); }
.review-list { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .7rem; }
.review-item { border: 2px solid var(--line); border-radius: 12px; padding: .6rem .9rem; background: #fff; }
.review-item.is-correct { border-color: var(--ok); background: var(--ok-bg); }
.review-item.is-wrong.was-selected { border-color: var(--bad); background: var(--bad-bg); }
.review-item.is-wrong:not(.was-selected) { background: #f7f7f4; }
.review-head { display: flex; gap: .6rem; align-items: flex-start; font-weight: 600; }
.review-verdict { font-size: .85rem; font-weight: 700; margin: .3rem 0 .1rem 2.3rem; }
.is-correct .review-verdict { color: var(--ok); }
.is-wrong.was-selected .review-verdict { color: var(--bad); }
.review-expl { margin: .1rem 0 .2rem 2.3rem; font-size: .95rem; }
.takeaway { background: var(--gold-soft); border: 2px solid var(--gold); border-radius: 12px; padding: .6rem 1rem; margin: 1rem 0; }
.takeaway p { margin: .2rem 0; }
.refs { font-size: .88rem; color: var(--muted); }
.refs ul { padding-left: 1.1rem; }
.refs li { margin-bottom: .4rem; }
.ref-flag { color: #8a5a00; font-style: italic; }

/* Formulaires */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1.4rem 1.4rem; box-shadow: var(--shadow); margin: 1.2rem 0; }
.form .field { margin: .9rem 0; display: flex; flex-direction: column; gap: .25rem; }
.form label { font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea { font: inherit; padding: .55rem .7rem; border: 2px solid #b9b4a4; border-radius: 10px; background: #fff; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: #1c5fd1; }
.checkline { display: flex; gap: .6rem; align-items: flex-start; margin: .8rem 0; font-weight: 400 !important; }
.checkline input { width: 1.2rem; height: 1.2rem; flex: none; margin-top: .25rem; }
.field-group { border-left: 4px solid var(--gold); padding-left: .8rem; }

/* Tableaux */
.table-scroll { overflow-x: auto; margin: .6rem 0; }
.board { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.board th, .board td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.board thead th { background: var(--green); color: #fff; font-size: .85rem; white-space: nowrap; }
.board .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.board .rank { font-weight: 800; white-space: nowrap; }
.board tr.mine { background: var(--gold-soft); }
.you { color: var(--red); font-weight: 700; font-size: .85rem; }
.small-table th, .small-table td { font-size: .9rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.tab { padding: .35rem .9rem; border-radius: 999px; border: 2px solid var(--green); text-decoration: none; color: var(--green); font-weight: 600; background: #fff; }
.tab.on { background: var(--green); color: #fff; }
.kpis { display: flex; gap: .8rem; flex-wrap: wrap; margin: .8rem 0; }
.kpi { background: #fff; border: 2px solid var(--gold); border-radius: 12px; padding: .5rem 1.1rem; display: flex; flex-direction: column; align-items: center; min-width: 8rem; }
.kpi strong { font-size: 1.6rem; color: var(--red); }
.kpi span { font-size: .8rem; color: var(--muted); }
.me-line { background: var(--gold-soft); padding: .5rem .9rem; border-radius: 10px; }
.prose p, .prose li { max-width: 62ch; }

.site-footer .copyright { margin-top: .6rem; color: var(--ink); }
.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.2rem 1rem 2rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.noscript { background: var(--bad-bg); padding: 1rem; text-align: center; }

/* Admin */
.admin-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; }
.status-ok { color: var(--ok); font-weight: 700; }
.status-ko { color: var(--bad); font-weight: 700; }
.status-warn { color: #8a5a00; font-weight: 700; }
pre.log { background: #1d2a24; color: #e8efe9; padding: .8rem; border-radius: 10px; overflow-x: auto; font-size: .8rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.admin-actions .btn { margin: .15rem .15rem .15rem 0; }
.danger-zone { border: 2px dashed var(--bad); border-radius: 12px; padding: .5rem 1rem 1rem; margin-top: 1.5rem; }

/* Neige décorative (désactivée si l'utilisateur préfère moins de mouvement) */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .5;
  background-image: radial-gradient(3px 3px at 20px 30px, #fff, transparent), radial-gradient(2px 2px at 120px 90px, #fff, transparent), radial-gradient(3px 3px at 220px 160px, #fff, transparent), radial-gradient(2px 2px at 320px 40px, #fff, transparent);
  background-size: 340px 200px; animation: fall 18s linear infinite; }
@keyframes fall { to { background-position: 40px 200px; } }
@media (prefers-reduced-motion: reduce) { .snow { animation: none; } a.door:hover { transform: none; } * { scroll-behavior: auto !important; } }


@media (max-width: 520px) {
  html { font-size: 16px; }
  .doors { grid-template-columns: repeat(2, 1fr); }
  .col-cat, .col-avg { display: none; }
  .brand-text small { display: none; }
}
@media print { .site-header, .snow, .nav, .site-footer, .cta, .btn { display: none !important; } body { background: #fff; } }

/* Compte à rebours et déroulé de la question */
.steps { color: var(--muted); font-size: .95rem; padding-left: 1.3rem; }
.stem-big { font-size: 1.25rem; padding: .8rem 1rem; background: var(--gold-soft); border-left: 6px solid var(--gold); border-radius: 10px; }
.timer .timer-time { font-size: 2.2rem; }
.timer-bar { flex-basis: 100%; height: 10px; background: rgba(255,255,255,.25); border-radius: 6px; overflow: hidden; }
.timer-bar-fill { --w: 100%; width: var(--w); height: 100%; background: var(--gold); border-radius: 6px; transition: width .25s linear; }
.timer-low { background: var(--red); animation: pulse 1s infinite; }
.timer-low .timer-bar-fill { background: #fff; }
.timer-off { background: #5b6a63; }
@keyframes pulse { 50% { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .timer-low { animation: none; } .timer-bar-fill { transition: none; } }

/* Contenu enrichi, dossier du patient, corrections détaillées */
.rich-h { margin: 1rem 0 .3rem; color: var(--green); }
.rich-list { margin: .3rem 0 .8rem; padding-left: 1.2rem; }
.rich-list li { margin-bottom: .25rem; }
.rich-table { border-collapse: collapse; width: 100%; font-size: .9rem; background: #fff; }
.rich-table th, .rich-table td { border: 1px solid var(--line); padding: .35rem .55rem; text-align: left; vertical-align: top; }
.rich-table th { background: var(--green); color: #fff; }
.dossier { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem 1rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.dossier summary { cursor: pointer; font-weight: 700; padding: .6rem 0; color: var(--green); }
.dossier-body { padding-bottom: .6rem; font-size: .97rem; }
.review-intro { background: #f4f1e8; border-radius: 12px; padding: .2rem 1rem .5rem; margin: .6rem 0; }
.review-expl p { margin: .1rem 0 .2rem; }
.review-expl { margin: .1rem 0 .2rem 2.3rem; font-size: .95rem; }
.extra { background: #eef5f9; border-left: 5px solid #4a89b8; border-radius: 10px; padding: .2rem 1rem .4rem; margin: .8rem 0; }
.extra-pitfall { background: var(--bad-bg); border-left-color: var(--bad); }
.extra h3 { font-size: 1rem; margin-top: .5rem; }
.door-soon { background: #f3f1ea; border-style: dotted; color: #8a8a7c; box-shadow: none; justify-content: center; }
.preview-bar { border-radius: 10px; margin: 1rem 0 0; }
.synthesis h3 { color: var(--green); }

/* ---- Question « urgence » : écran d'alerte et clavier téléphonique simulé ---- */
.alert-screen { position: relative; margin: 1rem 0; padding: 2.2rem 1rem 1.4rem; background: #b3202a; color: #fff; border: 4px solid #fff; outline: 4px solid #b3202a; border-radius: var(--radius); text-align: center; animation: alert-pulse 1.6s ease-in-out infinite; }
.alert-tag { position: absolute; top: .5rem; left: .75rem; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .9; background: rgba(0,0,0,.25); padding: .1rem .5rem; border-radius: 6px; }
.alert-line { margin: .3rem 0; font-size: clamp(1.25rem, 5vw, 2rem); font-weight: 800; line-height: 1.2; }
@keyframes alert-pulse { 50% { background: #8d1820; } }
@media (prefers-reduced-motion: reduce) { .alert-screen { animation: none; } }
.keypad-screen { display: block; width: 100%; max-width: 20rem; margin: .5rem auto; padding: .6rem .8rem; font-size: 2rem; text-align: center; letter-spacing: .15em; font-family: ui-monospace, Menlo, Consolas, monospace; border: 3px solid var(--green); border-radius: 12px; background: #fff; color: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; max-width: 20rem; margin: .5rem auto 1rem; }
.key { padding: .9rem 0; font-size: 1.5rem; font-weight: 700; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); cursor: pointer; }
.key:hover:not(:disabled) { border-color: var(--green-2); background: #f6fbf8; }
.key:disabled { opacity: .5; cursor: default; }
.key-call { background: var(--ok); border-color: var(--ok); color: #fff; }
.review-number { margin-top: 1rem; }
.site-desc { display: block; font-weight: 400; margin-top: .15rem; }
.answer-mode { display: inline-block; margin: .2rem 0 .8rem; padding: .3rem .8rem; border-radius: 999px; background: var(--info-bg); color: var(--green); font-weight: 700; border: 2px solid var(--green); }
.answer-mode-multiple { background: var(--gold-soft); }
.correct-box { margin: 1rem 0; padding: .8rem 1rem; border: 2px solid var(--ok); background: var(--ok-bg); border-radius: var(--radius); }
.correct-box h3 { margin: 0 0 .4rem; color: var(--ok); }
.correct-box ul { margin: 0; padding-left: 1.1rem; }
.correct-box li { margin: .25rem 0; }
