/* Style inspiré de la carte Domino's : bleu, rouge, fond gris clair, boutons en majuscules.
   Contrastes vérifiés : tous les textes atteignent au moins 7:1 sur blanc (niveau AAA), sauf le rouge
   sur gris clair (6,3:1, niveau AA) ; bordures des champs et boutons au moins 4,5:1. */
:root {
    --blue: #00557c;
    --blue-dark: #003a56;
    --red: #b0102a;
    --red-dark: #8c0c21;
    --bg: #f2f2f2;
    --surface: #ffffff;
    --text: #2b2b2b;
    --muted: #4a4a4a;
    --border: #dcdcdc;
    --border-strong: #767676;
    --success: #145a28;
    --error: #a50e27;
    --veg: #1b5e20;
    --spicy: #a62d00;
    --radius: 6px;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.12);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
/* L'attribut hidden doit l'emporter sur les display définis plus bas (filtres de la carte). */
[hidden] { display: none !important; }

/* Taille de base 20 px au lieu de 16 px : tout le texte, exprimé en rem, grandit d'environ 4 px. */
html { font-size: 125%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 1rem/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--blue); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; color: var(--blue); }
h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; }
h2 { font-size: 1.25rem; font-weight: 800; }
h3 { font-size: 1.1rem; margin-top: 1.75rem; text-transform: uppercase; font-weight: 800; }
img { max-width: 100%; height: auto; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline { display: inline; }

/* En-tête bleu */
.topbar { background: var(--blue); color: #fff; margin-bottom: 24px; box-shadow: var(--shadow); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: #fff; text-decoration: none; text-transform: uppercase; letter-spacing: 0.02em; }
.topnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
/* Boutons de l'en-tête : fond bleu foncé et bordure blanche ; page courante et survol en blanc. */
.nav-btn {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
    border: 1px solid rgb(255 255 255 / 0.7); border-radius: 4px; background: var(--blue-dark); color: #fff;
    font: inherit; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
    text-decoration: none; cursor: pointer;
}
.nav-btn:hover, .nav-btn[aria-current="page"] { background: #fff; color: var(--blue); border-color: #fff; }
.nav-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.who::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px; border-radius: 4px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--blue); font: inherit; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.02em; font-size: 0.875rem; cursor: pointer;
}
.btn:hover { border-color: var(--blue); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-small { padding: 5px 10px; font-size: 0.75rem; }
.btn-danger { color: var(--error); border-color: color-mix(in srgb, var(--error) 45%, transparent); }
.btn-danger:hover { border-color: var(--error); }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--error); font-size: 0.85rem; }

/* Messages : bordure fine tout autour et point de couleur, jamais de barre latérale. */
.alert {
    display: flex; align-items: baseline; gap: 8px;
    padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px;
    background: var(--surface);
}
.alert::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; transform: translateY(-1px); }
.alert-success { color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 45%, transparent); }
.alert-error { color: var(--error); border: 1px solid color-mix(in srgb, var(--error) 45%, transparent); }

/* Cartes et formulaires */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; box-shadow: var(--shadow); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; font-weight: 600; }
.form small { font-weight: 400; color: var(--muted); }
.form label.checkbox, .form label.radio { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
input, select, textarea {
    font: inherit; color: var(--text); background: #fff;
    border: 1px solid var(--border-strong); border-radius: 4px; padding: 9px 10px; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; flex: none; accent-color: var(--blue); margin: 2px 0 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.diet { display: grid; gap: 6px; }
.form-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.form-row input { flex: 1 1 160px; width: auto; }

.auth { max-width: 460px; margin: 0 auto; }
.auth .lead { color: var(--muted); }
.auth h1 { font-size: 1.6rem; }

/* Bandeau d'accueil */
.hero { margin-bottom: 20px; }
.lead { font-size: 1.05rem; max-width: 75ch; }
.deadline { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; padding: 6px 12px; border-radius: var(--radius); background: var(--surface); font-size: 0.95rem; }
.deadline .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.deadline.is-open { color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 45%, transparent); }
.deadline.is-closed { color: var(--error); border: 1px solid color-mix(in srgb, var(--error) 45%, transparent); }
.deadline strong { color: var(--text); }
.countdown { color: var(--muted); }

.top-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.top-grid .card { margin-bottom: 0; }
.top-grid + .menu { margin-top: 32px; }
.count { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-left: 6px; text-transform: none; }

/* Classement des pizzas les plus choisies */
/* Bonhomme du classement : il pleure dès la première pizza, de plus en plus fort (niveaux 1 à 5).
   Ses poings frottent ses yeux (les bras pivotent depuis les épaules, en alternance), sa tête suit le mouvement
   et les larmes coulent de sous les poings le long des joues. */
.ranking-head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.ranking-head h2 { margin: 0; }
.crier-scene { display: flex; align-items: center; gap: 18px; }
.crier { flex: none; overflow: visible; --tear-duration: 2.4s; --tear-scale: 0.6; --hand-duration: 1.4s; }
.crier[data-level="2"] { --tear-duration: 1.8s; --tear-scale: 0.85; --hand-duration: 1.1s; }
.crier[data-level="3"] { --tear-duration: 1.3s; --tear-scale: 1.1; --hand-duration: 0.85s; }
.crier[data-level="4"] { --tear-duration: 0.9s; --tear-scale: 1.35; --hand-duration: 0.65s; }
.crier[data-level="5"] { --tear-duration: 0.6s; --tear-scale: 1.6; --hand-duration: 0.45s; }
.crier .crier-head, .crier .tear { transform-box: fill-box; transform-origin: center; }
.crier .arm { transform-box: view-box; }
.crier .arm-left { transform-origin: 24px 84px; animation: rub-left var(--hand-duration) ease-in-out infinite; }
.crier .arm-right { transform-origin: 76px 84px; animation: rub-right var(--hand-duration) ease-in-out infinite; }
.crier .crier-head { animation: head-bob var(--hand-duration) ease-in-out infinite; }
.crier .tear { animation: tear-fall var(--tear-duration) ease-in infinite; }
.crier .tear-right { animation-delay: calc(var(--tear-duration) / -2); }
.crier[data-level="0"] .tear { display: none; }
.crier[data-level="0"] .arm, .crier[data-level="0"] .crier-head { animation: none; }
@keyframes rub-left {
    0%, 100% { transform: rotate(-5deg) translateY(0); }
    50% { transform: rotate(5deg) translateY(-3px); }
}
@keyframes rub-right {
    0%, 100% { transform: rotate(5deg) translateY(-3px); }
    50% { transform: rotate(-5deg) translateY(0); }
}
@keyframes head-bob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(2px) rotate(3deg); }
}
@keyframes tear-fall {
    0% { transform: translateY(0) scale(var(--tear-scale)); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translateY(28px) scale(var(--tear-scale)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .crier .arm, .crier .crier-head, .crier .tear { animation: none; }
    .crier .tear { transform: scale(var(--tear-scale)); }
}
/* Bulle de BD façon webtoon : ovale blanc, contour noir épais, légèrement penché, pointe vers la bouche. */
.speech {
    position: relative; margin: 0; padding: 10px 18px; max-width: 260px;
    background: #fff; color: #1a1a1a; border: 3px solid #1a1a1a; border-radius: 40px;
    font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", cursive;
    font-size: 0.95rem; font-weight: 700; line-height: 1.25; transform: rotate(-3deg);
}
.speech::before, .speech::after { content: ""; position: absolute; top: 55%; clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.speech::before { left: -22px; width: 26px; height: 24px; margin-top: -12px; background: #1a1a1a; }
.speech::after { left: -15px; width: 22px; height: 15px; margin-top: -7.5px; background: #fff; }
.crier { flex: none; overflow: visible; --tear-duration: 2.4s; --tear-scale: 0.6; --hand-duration: 1.4s; }
.crier[data-level="2"] { --tear-duration: 1.8s; --tear-scale: 0.85; --hand-duration: 1.1s; }
.crier[data-level="3"] { --tear-duration: 1.3s; --tear-scale: 1.1; --hand-duration: 0.85s; }
.crier[data-level="4"] { --tear-duration: 0.9s; --tear-scale: 1.35; --hand-duration: 0.65s; }
.crier[data-level="5"] { --tear-duration: 0.6s; --tear-scale: 1.6; --hand-duration: 0.45s; }
.crier .hand, .crier .crier-head, .crier .tear { transform-box: fill-box; transform-origin: center; }
.crier .hand-left { animation: hand-bob var(--hand-duration) ease-in-out infinite; }
.crier .hand-right { animation: hand-bob var(--hand-duration) ease-in-out infinite reverse; }
.crier .crier-head { animation: head-bob var(--hand-duration) ease-in-out infinite; }
.crier .tear { animation: tear-fall var(--tear-duration) ease-in infinite; }
.crier .tear-right { animation-delay: calc(var(--tear-duration) / -2); }
.crier[data-level="0"] .tear { display: none; }
.crier[data-level="0"] .hand, .crier[data-level="0"] .crier-head { animation: none; }
@keyframes hand-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}
@keyframes head-bob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(2px) rotate(3deg); }
}
@keyframes tear-fall {
    0% { transform: translateY(0) scale(var(--tear-scale)); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translateY(26px) scale(var(--tear-scale)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .crier .hand, .crier .crier-head, .crier .tear { animation: none; }
    .crier .tear { transform: scale(var(--tear-scale)); }
}
/* Classement : une case par pizza (photo, nombre de choix, nom), d'autant plus grande qu'elle est choisie. */
.rank-grid {
    list-style: none; padding: 0; margin: 0; display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); grid-auto-rows: minmax(104px, auto); grid-auto-flow: dense;
}
.rank-tile { position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px; background: #e8e8e8; border-radius: var(--radius); cursor: default; }
.rank-tile:hover, .rank-tile:focus { background: #dcdcdc; }
.rank-tile:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* overflow: hidden fait respecter la proportion de la case, au lieu de la taille naturelle de la photo. */
.rank-media { position: relative; flex: none; height: 100%; max-height: 84px; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; }
.rank-tile.size-3 .rank-media, .rank-tile.size-4 .rank-media { max-height: none; }
.rank-media { max-width: 55%; }
.rank-info { flex: 1 1 auto; }
.rank-tile.size-3 { flex-direction: column; align-items: stretch; }
.rank-tile.size-3 .rank-media { width: 100%; max-width: none; height: auto; aspect-ratio: 5 / 2; }
.rank-media img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.rank-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-badge {
    flex: none; min-width: 1.8em; padding: 4px 8px;
    background: var(--blue); color: #fff; font-weight: 800; text-align: center; border-radius: 4px;
}
/* Nom sur une seule ligne (points de suspension en dernier recours, jamais de coupure au milieu d'un mot). */
.rank-name { min-width: 0; padding: 4px 10px; background: #fff; border-radius: 4px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* La case survolée passe au premier plan, pour que la bulle des prénoms ne soit pas cachée par la case suivante. */
.rank-tile:hover, .rank-tile:focus, .rank-tile:focus-within { z-index: 10; }
/* Petite case : bandeau photo au-dessus, chiffre et nom en dessous, sur toute la largeur de la case. */
.rank-tile.size-1 { flex-direction: column; align-items: stretch; gap: 8px; }
.rank-tile.size-1 .rank-media { width: 100%; max-width: none; max-height: none; height: auto; aspect-ratio: 5 / 2; }
.rank-tile.size-1 .rank-name { font-size: 0.85rem; padding: 4px 8px; }
/* Demande libre dans la fenêtre de pizza. */
.note-field { display: grid; gap: 4px; font-weight: 600; }
.note-field small { font-weight: 400; color: var(--muted); }
.note { display: block; color: var(--muted); font-style: italic; }
/* Admin : champ de demande modifiable sous chaque pizza (remplacé par le texte à l'impression). */
.item-note { display: flex; gap: 6px; margin: 4px 0; }
.item-note input { flex: 1 1 auto; min-width: 0; padding: 4px 8px; font-size: 0.85rem; }
.print-only { display: none; }
.rank-tile.size-2 { grid-column: span 2; }
.rank-tile.size-3 { grid-column: span 2; grid-row: span 2; }
.rank-tile.size-4 { grid-column: span 3; grid-row: span 2; }
.rank-tile.size-3 .rank-name, .rank-tile.size-4 .rank-name { font-size: 1.25rem; }
.rank-tile.size-3 .rank-badge, .rank-tile.size-4 .rank-badge { font-size: 1.25rem; padding: 4px 12px; }
.rank-names {
    position: absolute; z-index: 5; left: 8px; right: 8px; top: 100%; margin-top: 4px;
    padding: 8px 10px; border-radius: 4px; background: var(--blue-dark); color: #fff; font-size: 0.85rem;
    box-shadow: var(--shadow); opacity: 0; visibility: hidden; transition: opacity 0.12s;
}
.rank-tile:hover .rank-names, .rank-tile:focus .rank-names { opacity: 1; visibility: visible; }

/* Mon choix */
.my-items { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.my-items li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.my-items img { border-radius: 4px; object-fit: cover; }
.my-item-name { display: grid; flex: 1 1 160px; min-width: 0; }
.my-item-name small { color: var(--muted); }
.my-item-actions { display: flex; gap: 6px; }
.my-total { margin: 0 0 12px; }
.price { font-weight: 800; white-space: nowrap; color: var(--blue); }
.allergy { color: var(--error); }

/* Carte des pizzas */
.menu-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.menu-head h2 { margin: 0; font-size: 1.5rem; text-transform: uppercase; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--blue); background: var(--surface); color: var(--blue); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.chip.is-active { background: var(--blue); color: #fff; }
.grid, .menu.is-filtered .categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
/* Filtre actif : les catégories s'effacent et leurs pizzas rejoignent la grille commune. */
.menu.is-filtered .categories { margin-top: 1.25rem; }
.menu.is-filtered .category, .menu.is-filtered .category .grid { display: contents; }
.menu.is-filtered .category h3 { display: none; }
.pizza { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.pizza-media { position: relative; background: #fff; }
.pizza-media img { display: block; width: 100%; aspect-ratio: 400 / 290; object-fit: cover; }
.add-form { position: absolute; right: 10px; bottom: 10px; margin: 0; }
.btn-add { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 0.25); padding: 9px 16px; }
.btn-add:hover { background: var(--red-dark); border-color: var(--red-dark); }
.pizza-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 16px; flex: 1; border-top: 1px solid var(--border); }
.pizza-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pizza-title h4 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--text); }
.price-tag { flex: none; background: var(--blue); color: #fff; font-weight: 800; font-size: 0.9rem; padding: 2px 10px; border-radius: 4px; white-space: nowrap; }
/* Composition en pastilles (base puis ingrédients), même encadrement que dans la fenêtre de pizza. */
.ingredient-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.ing, .ingredient-fixed, .ingredient { border: 1px solid var(--border-strong); border-radius: 999px; background: #fff; color: var(--text); }
.ing { padding: 2px 10px; font-size: 0.8rem; }
.ing-base { background: var(--bg); font-weight: 700; }

.tags { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; padding: 0; margin: 0; }
.tags:empty { display: none; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
/* Pastilles pleines : texte blanc sur la couleur du label (contraste 7:1 ou plus). */
.tag-veg { background: var(--veg); border-color: var(--veg); color: #fff; }
.tag-spicy { background: var(--spicy); border-color: var(--spicy); color: #fff; }

.tag-allergy { background: var(--error); border-color: var(--error); color: #fff; text-transform: none; }

/* Allergies : case à cocher puis liste déroulante d'ingrédients à cocher */
.allergies { display: grid; gap: 8px; }
.multiselect { border: 1px solid var(--border-strong); border-radius: 4px; background: #fff; }
.multiselect summary { display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; cursor: pointer; font-weight: 600; list-style: none; }
.multiselect summary::-webkit-details-marker { display: none; }
.multiselect summary::after {
    content: ""; width: 14px; height: 14px; margin-top: 4px; flex: none; transition: transform 0.15s;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%23006491' stroke-width='2'/%3E%3C/svg%3E") no-repeat center;
}
.multiselect[open] summary::after { transform: rotate(180deg); }
.multiselect-count { margin-left: auto; white-space: nowrap; color: var(--muted); font-weight: 400; font-size: 0.875rem; }
.multiselect-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; max-height: 260px; overflow-y: auto; padding: 8px 10px 10px; border-top: 1px solid var(--border); }
.form .multiselect-list label.checkbox { font-size: 0.9rem; }

/* Fenêtre de personnalisation */
.dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 10px 40px rgb(0 0 0 / 0.3); }
.dialog::backdrop { background: rgb(0 0 0 / 0.5); }
.dialog-form { display: grid; gap: 18px; padding: 20px; }
.dialog-head { display: flex; gap: 14px; align-items: center; }
.dialog-head img { border-radius: 4px; object-fit: cover; flex: none; }
.dialog-head h2 { margin: 0 0 2px; }
.dialog-head p { margin: 0; }
.options { display: flex; gap: 8px; flex-wrap: wrap; }
.option { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 4px; cursor: pointer; font-size: 0.9rem; }
.option:has(input:checked) { border-color: var(--blue); color: var(--blue); font-weight: 600; }
.option input { margin: 0; }
/* Ingrédients : fixes (simple étiquette) ou retirables (pointillés, cliquables) ; un ingrédient retiré est barré. */
.dialog .ingredient-fixed, .dialog .ingredient { border-radius: 999px; padding: 5px 14px; }
.ingredient-fixed { cursor: default; }
.ingredient input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ingredient { position: relative; border-style: dashed; border-color: var(--blue); color: var(--blue); }
.ingredient:has(input:checked) { color: var(--muted); border-color: var(--border-strong); font-weight: 400; }
.ingredient:has(input:checked) span { text-decoration: line-through; }
.ingredient:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 1px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.allergy-warning { margin: 0; }
.allergy-confirm { display: grid; gap: 12px; padding: 14px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--error) 45%, transparent); background: color-mix(in srgb, var(--error) 6%, #fff); }
.allergy-confirm p { margin: 0; color: var(--error); font-weight: 600; }
.allergy-confirm .dialog-actions { justify-content: flex-start; }
.sauce-fixed { margin: 0; font-size: 0.9rem; }
.removable-select { min-width: 200px; font-size: 0.875rem; }
.removable-select summary { font-weight: 400; }
.removable-select .multiselect-list { grid-template-columns: 1fr; max-height: 220px; }
.btn-warning, .btn-primary.btn-warning { background: #fff; color: var(--error); border-color: var(--error); }
.btn-warning:hover, .btn-primary.btn-warning:hover { background: color-mix(in srgb, var(--error) 8%, #fff); }

/* Administration */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-radius: 4px 4px 0 0; }
.tabs a.is-active { color: var(--blue); background: var(--surface); border: 1px solid var(--border); border-bottom-color: var(--surface); margin-bottom: -1px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; }
.table tfoot th { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; margin-bottom: 16px; }
.table-pizzas td { vertical-align: middle; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.price-input { width: 80px; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li + li { margin-top: 6px; }
.copy-label { display: block; margin: 16px 0 4px; font-weight: 600; }
.summary-text { font-family: Consolas, ui-monospace, monospace; font-size: 0.875rem; resize: vertical; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Pages de texte */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4rem; font-size: 1.1rem; }

.footer { margin-top: 40px; padding: 20px 0 32px; background: var(--blue-dark); color: #fff; font-size: 0.85rem; }
.footer a { color: #fff; }
.footer p { margin: 0 0 6px; }
.thanks { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 1rem; font-weight: 700; text-align: center; }
/* Photo de l'organisateur en pizzaïolo, affichée seulement si le fichier existe dans assets/. */
/* Fond de page : la même photo, en grand, très estompée et fixe derrière le contenu. */
.page-bg { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; opacity: 0.16; pointer-events: none; }
/* Rond zoomé sur le visage : réglé pour la photo actuelle (visage centré, vers le tiers haut de l'image). */
.chef { position: relative; flex: none; display: inline-block; overflow: hidden; border-radius: 50%; border: 3px solid #fff; background: #fff; box-shadow: var(--shadow); }
.chef img { position: absolute; width: 220%; max-width: none; height: auto; left: -60%; top: -44%; }
.chef-hero { width: 72px; height: 72px; }
.chef-auth { width: 96px; height: 96px; }
.chef-footer { width: 56px; height: 56px; }
.title-with-chef { display: flex; align-items: center; gap: 14px; margin-bottom: 0.5em; }
.title-with-chef h1 { margin: 0; }
/* "Enzo" tourne de plus en plus vite pendant 4,5 s, puis marque une pause d'une demi-seconde, en boucle. */
.spin { display: inline-block; animation: spin-faster 5s infinite; }
@keyframes spin-faster {
    0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.7, 0, 1, 1); }
    90% { transform: rotate(2160deg); }
    100% { transform: rotate(2160deg); }
}
/* Personnes sensibles aux mouvements (réglage du système) : pas d'animation. */
@media (prefers-reduced-motion: reduce) {
    .spin { animation: none; }
}

@media (max-width: 800px) {
    .top-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .wrap { padding: 0 12px; }
    .table th, .table td { padding: 6px 4px; font-size: 0.875rem; }
    .card { padding: 16px; }
    h1 { font-size: 1.3rem; }

    /* En-tête : boutons sur une grille de deux colonnes, pleine largeur. */
    .topbar { margin-bottom: 16px; }
    .topbar-inner { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
    .topnav { display: grid; grid-template-columns: 1fr 1fr; width: 100%; padding: 0; }
    .topnav .inline { display: contents; }
    .nav-btn { justify-content: center; width: 100%; }

    .deadline { display: flex; }
    .filters { width: 100%; }
    .chip { flex: 1 1 auto; }

    /* Mon choix : actions sur leur propre ligne, boutons faciles à toucher. */
    .my-items img { display: none; }
    .my-items li { flex-wrap: wrap; }
    .my-item-actions { width: 100%; }
    .my-item-actions .btn, .my-item-actions form { flex: 1; }
    .my-item-actions form .btn { width: 100%; }
    .btn-small { min-height: 44px; }
    /* Classement sur téléphone : deux colonnes, photo au-dessus du nom. */
    .rank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; }
    .rank-tile { flex-direction: column; align-items: stretch; gap: 8px; }
    .rank-media, .rank-tile.size-1 .rank-media { height: auto; width: 100%; max-width: none; max-height: none; aspect-ratio: 4 / 3; }
    /* Paliers visibles sur deux colonnes : 2 fois = bandeau, 3 ou 4 fois = grande photo, 5 fois et plus = très grande. */
    .rank-tile.size-2 { flex-direction: row; align-items: center; }
    /* Sur téléphone, un nom trop long passe à la ligne entre deux mots. */
    .rank-name { white-space: normal; overflow: visible; }
    .rank-tile.size-2 .rank-media { width: 45%; max-width: 45%; }
    .rank-tile.size-3, .rank-tile.size-4 { grid-column: span 2; grid-row: auto; }
    .rank-tile.size-3 .rank-media { aspect-ratio: 2 / 1; }

    /* Cartes compactes : vignette à gauche, texte à droite, bouton Ajouter sur toute la largeur. */
    .grid, .menu.is-filtered .categories { grid-template-columns: 1fr; gap: 12px; }
    .pizza { display: grid; grid-template-columns: 116px 1fr; }
    .pizza-media { display: contents; }
    .pizza-media img { grid-column: 1; grid-row: 1; width: 104px; height: 104px; margin: 12px 0 0 12px; border-radius: 4px; }
    .pizza-body { grid-column: 2; grid-row: 1; border-top: 0; padding: 12px; gap: 6px; }
    .pizza-title { flex-direction: column; align-items: flex-start; gap: 4px; }
    .add-form { position: static; grid-column: 1 / -1; grid-row: 2; margin: 0 12px 12px; }
    .btn-add { width: 100%; min-height: 44px; box-shadow: none; }

    /* Fenêtre de pizza en plein écran, boutons toujours visibles en bas. */
    .dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0; }
    .dialog-form { padding: 16px 16px 0; }
    .dialog-head img { width: 84px; height: 61px; }
    .dialog-form > .dialog-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 16px; border-top: 1px solid var(--border); }
    .dialog-actions .btn { flex: 1 1 auto; min-height: 48px; }
}

.chip { min-height: 44px; }

/* Sélecteur de compte local (outil de développement, absent du site en ligne). */
.dev-switch { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 4px 8px; border: 1px dashed #fff; border-radius: 4px; }
.dev-switch-label { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.dev-btn { min-height: 36px; padding: 4px 10px; border: 1px solid #fff; border-radius: 4px; background: transparent; color: #fff; font: inherit; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.dev-btn:hover, .dev-btn.is-current { background: #fff; color: var(--blue); }
.dev-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ===== Surprise (un collègue désigné dans config.php, à chaque connexion) ===== */
/* Version italienne : vert et rouge du drapeau (contraste 7:1 sur blanc), bandeau tricolore sous l'en-tête. */
body.italia { --blue: #006633; --blue-dark: #00592c; --red: #b0102a; --red-dark: #8c0c21; }
.italia .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px; background: linear-gradient(90deg, #006633 0 33.3%, #fff 33.3% 66.6%, #b0102a 66.6%); }
.page-bg-paff { opacity: 0.22; object-position: 50% 50%; }

/* Bonhomme qui rit : il se secoue, ouvre et ferme la bouche comme Pac-Man et recrache des parts de pizza. */
.crier.laughing .laugh-body { transform-box: view-box; transform-origin: 50px 100px; animation: laugh-shake 0.35s ease-in-out infinite; }
.crier.laughing .pacman-mouth { transform-box: fill-box; transform-origin: 50% 0; animation: chomp 0.35s steps(2, jump-none) infinite; }
.crier.laughing .spit-slice { transform-box: view-box; opacity: 0; animation: spit 1.2s ease-out infinite; }
.crier.laughing .spit-2 { animation-delay: 0.4s; }
.crier.laughing .spit-3 { animation-delay: 0.8s; }
@keyframes laugh-shake {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-3px) rotate(2deg); }
}
@keyframes chomp {
    0% { transform: scaleY(1); }
    100% { transform: scaleY(0.25); }
}
@keyframes spit {
    0% { transform: translate(0, 0) rotate(0); opacity: 1; }
    100% { transform: translate(46px, 14px) rotate(220deg); opacity: 0; }
}

/* Question PAFF avant chaque pizza ajoutée. */
.paff-confirm { display: grid; gap: 10px; padding: 14px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--blue) 45%, transparent); background: #fff; }
.paff-title { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--blue); }
.paff-acrostic { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.paff-acrostic strong { display: inline-block; width: 1.4em; color: var(--red); font-size: 1.3rem; }
.paff-nope { margin: 0; color: var(--error); font-weight: 600; }
.paff-confirm .dialog-actions { justify-content: flex-start; }

/* Pluie de pizzas à l'arrivée. */
.pizza-rain { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.pizza-rain img { position: absolute; top: -120px; border-radius: 50%; animation: pizza-fall linear forwards; }
@keyframes pizza-fall {
    0% { transform: translateY(0) rotate(0); }
    100% { transform: translateY(calc(100vh + 160px)) rotate(540deg); }
}

@media (prefers-reduced-motion: reduce) {
    .crier.laughing .laugh-body, .crier.laughing .pacman-mouth, .crier.laughing .spit-slice { animation: none; }
}

/* ===== Effets ===== */
/* 1. Compte à rebours : orange dans les dernières 24 h, rouge qui pulse dans la dernière heure. */
.deadline.is-soon { color: #8f3f00; border-color: color-mix(in srgb, #8f3f00 45%, transparent); }
.deadline.is-urgent { color: var(--error); border-color: color-mix(in srgb, var(--error) 45%, transparent); animation: urgent-pulse 1.4s ease-in-out infinite; }
@keyframes urgent-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--error) 40%, transparent); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

/* 2. Popularité sur la carte. */
.tag-hot { background: #8f3f00; border-color: #8f3f00; color: #fff; text-transform: none; }

/* 3. Barre "Mon choix" collée en bas, sur téléphone. */
.mobile-bar { display: none; }

/* 4. En-tête collé en haut, qui se rétrécit quand on descend. */
.topbar { position: sticky; top: 0; z-index: 30; }
.topbar.is-compact .topbar-inner { min-height: 44px; }
.topbar.is-compact .topnav { padding: 4px 0; }
.topbar.is-compact .nav-btn { min-height: 34px; padding: 4px 10px; font-size: 0.7rem; }
.topbar.is-compact .dev-switch { display: none; }
#mon-choix, .menu, .ranking { scroll-margin-top: 90px; }

/* 5 et 11. Au survol d'une carte : elle se soulève, la pizza pivote et de la fumée chaude monte.
   Agrandie de 35 %, la photo couvre toujours son cadre même tournée de 12 degrés : aucun coin blanc. */
.pizza { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.pizza-media { overflow: hidden; }
.pizza-media img { transition: transform 1.2s ease; }
.add-form { z-index: 2; }
.steam { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.steam i {
    position: absolute; bottom: 30%; width: 34px; height: 110px; border-radius: 50%; opacity: 0;
    background: radial-gradient(closest-side, rgb(255 255 255 / 0.95), rgb(255 255 255 / 0.4) 60%, transparent);
    filter: blur(5px) drop-shadow(0 0 6px rgb(0 0 0 / 0.35));
}
.steam i:nth-child(1) { left: 30%; }
.steam i:nth-child(2) { left: 46%; height: 130px; }
.steam i:nth-child(3) { left: 62%; }
@media (hover: hover) {
    .pizza:hover { transform: translateY(-4px); box-shadow: 0 8px 22px rgb(0 0 0 / 0.18); }
    .pizza:hover .pizza-media img { transform: scale(1.35) rotate(12deg); }
    .pizza:hover .steam i { animation: steam 2s ease-out infinite; }
    .pizza:hover .steam i:nth-child(2) { animation-delay: 0.65s; }
    .pizza:hover .steam i:nth-child(3) { animation-delay: 1.3s; }
}
@keyframes steam {
    0% { transform: translateY(30px) scaleX(0.7); opacity: 0; }
    25% { opacity: 0.95; }
    60% { transform: translateY(-30px) scaleX(1.2) translateX(6px); }
    100% { transform: translateY(-80px) scaleX(1.5) translateX(-6px); opacity: 0; }
}

/* 6. La pizza ajoutée file vers "Mon choix", dont le compteur rebondit. */
.fly-clone { position: fixed; z-index: 90; border-radius: 50%; object-fit: cover; pointer-events: none; box-shadow: var(--shadow); }
.count.bounce { display: inline-block; color: var(--red); animation: bounce 0.7s ease 2; }
@keyframes bounce {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.6); }
}

/* 7. Classement : les cases apparaissent l'une après l'autre. */
.rank-grid.is-animated .rank-tile { animation: tile-in 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.2) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes tile-in {
    from { opacity: 0; transform: translateY(30px) scale(0.85); }
    to { opacity: 1; transform: none; }
}

/* 8. Messages en bulles, en bas de l'écran ; ceux de réussite disparaissent seuls. */
.toasts {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 100;
    display: grid; gap: 8px; width: min(480px, calc(100vw - 24px)); pointer-events: none;
}
.toast { margin: 0; pointer-events: auto; box-shadow: 0 6px 20px rgb(0 0 0 / 0.2); animation: toast-in 0.35s ease both; }
.toast.is-leaving { animation: toast-out 0.35s ease forwards; }
.toast-close { margin-left: auto; padding: 0 4px; border: 0; background: none; color: inherit; font: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(16px); } }

/* 9. Halloween (28 au 31 octobre) : en-tête noir, décor qui flotte, bonhomme déguisé en fantôme. */
.crier .ghost-sheet { display: none; }
body.halloween .crier .ghost-sheet { display: inline; }
body.halloween .crier .arm rect { fill: #f5f5f5; stroke: #9e9e9e; }
body.halloween .crier .arm path:last-child { stroke: #9e9e9e; }
body.halloween .topbar { background: #1f1f1f; }
body.halloween .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px; background: #e65100; }
.halloween-deco { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.halloween-deco svg { position: absolute; width: 44px; height: auto; opacity: 0.85; animation: float-spooky 6s ease-in-out infinite; }
.halloween-deco svg:nth-child(1) { top: 14%; left: 3%; }
.halloween-deco svg:nth-child(2) { top: 22%; right: 5%; animation-delay: -1s; }
.halloween-deco svg:nth-child(3) { top: 45%; left: 2%; animation-delay: -2s; }
.halloween-deco svg:nth-child(4) { top: 60%; right: 3%; animation-delay: -3s; }
.halloween-deco svg:nth-child(5) { top: 78%; left: 5%; animation-delay: -4s; }
.halloween-deco svg:nth-child(6) { top: 88%; right: 8%; animation-delay: -5s; }
.halloween-deco svg:nth-child(7) { top: 33%; left: 48%; animation-delay: -2.5s; }
.halloween-deco svg:nth-child(8) { top: 70%; left: 50%; animation-delay: -1.5s; }
@keyframes float-spooky {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50% { transform: translateY(-18px) rotate(6deg); }
}

/* 10. Bonhomme cliquable : il sursaute, ses larmes giclent et la bulle change.
   Trop embêté, il se fâche (visage rouge, sourcils froncés) et bloque les commandes jusqu'aux excuses. */
.crier .brows-angry { display: none; }
.crier.is-angry .brows-angry { display: inline; }
.crier.is-angry .brows-sad, .crier.is-angry .tear { display: none; }
.crier.is-angry .face { fill: #ff7043; stroke: #bf360c; }
.crier.is-angry .arm { display: none; }
/* Fâché : bras musclés levés en double biceps, qui se contractent en rythme. */
.crier .muscle-arms { display: none; }
.crier.is-angry .muscle-arms { display: inline; }
.crier .muscle { transform-box: fill-box; transform-origin: 100% 80%; }
.crier.is-angry .muscle { animation: flex 0.5s ease-in-out infinite alternate; }
@keyframes flex {
    from { transform: rotate(0) scale(1); }
    to { transform: rotate(-8deg) scale(1.08); }
}
body.halloween .crier .muscle path, body.halloween .crier .muscle circle { fill: #f5f5f5; stroke: #9e9e9e; }
.crier.is-angry { animation: anger-shake 0.25s linear infinite; }
@keyframes anger-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px) rotate(-2deg); }
    75% { transform: translateX(2px) rotate(2deg); }
}
.crier-scene { flex-wrap: wrap; }
.crier-sorry { align-self: center; }
.btn-add:disabled { background: var(--muted); border-color: var(--muted); cursor: not-allowed; }
.crier-btn { padding: 0; border: 0; background: none; line-height: 0; cursor: pointer; border-radius: 50%; }
.crier-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
.crier.is-poked { animation: poke-shake 0.6s ease; }
.crier.is-poked .tear { animation: tear-splash 0.6s ease-out; }
@keyframes poke-shake {
    0%, 100% { transform: none; }
    20% { transform: rotate(-12deg) scale(1.1); }
    50% { transform: rotate(10deg); }
    75% { transform: rotate(-6deg); }
}
@keyframes tear-splash {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: translate(30px, -20px) scale(2.2); opacity: 0; }
}

@media (max-width: 600px) {
    .mobile-bar {
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
        position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40; min-height: 52px; padding: 10px 16px;
        border-radius: var(--radius); background: var(--blue-dark); color: #fff; font-weight: 700; text-decoration: none;
        box-shadow: 0 4px 16px rgb(0 0 0 / 0.3); transition: transform 0.25s ease, opacity 0.25s ease;
    }
    .mobile-bar.is-hidden { transform: translateY(150%); opacity: 0; pointer-events: none; }
    .mobile-bar-go { padding: 4px 12px; border-radius: 4px; background: #fff; color: var(--blue-dark); font-size: 0.8rem; text-transform: uppercase; }
    body:has(.mobile-bar) .footer { padding-bottom: 90px; }
    body:has(.mobile-bar) .toasts { bottom: 76px; }
    /* Cartes compactes : pas de fumée (l'image est rangée directement dans la grille de la carte). */
    .steam { display: none; }
    .topbar.is-compact .brand { display: none; }
    .topbar.is-compact .topnav { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .deadline.is-urgent, .count.bounce, .rank-grid.is-animated .rank-tile, .toast, .toast.is-leaving,
    .halloween-deco svg, .crier.is-poked, .crier.is-poked .tear, .crier.is-angry, .crier.is-angry .muscle, .steam i { animation: none; }
    .pizza, .pizza-media img, .mobile-bar { transition: none; }
}

@media print {
    .topbar, .footer, .tabs, .no-print, .page-bg, .toasts, .mobile-bar, .halloween-deco { display: none !important; }
    .print-only { display: block; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; padding: 0; }
}
