/* =====================================================================
   Bye Bye Roubaix — feuille de style unique
   Palette mood board : rose / vert sauge / orange / crème / noir
   ===================================================================== */

:root {
    --bg:         #FFF7F0;
    --bg-card:    #FFFFFF;
    --ink:        #2B2B2B;
    --muted:      #7A7A7A;
    --line:       #EADFD4;

    --rose:       #E98BA3;
    --rose-soft:  #F8D4DE;
    --vert:       #7FA87A;
    --vert-soft:  #D5E5CE;
    --orange:     #F0A868;
    --orange-soft:#FCE0C6;
    --bleu:       #6CA6CD;
    --bleu-soft:  #CFE2EE;
    --noir:       #1A1A1A;

    --page-color: var(--rose);

    --radius:     18px;
    --radius-sm:  10px;
    --shadow:     0 8px 28px rgba(30, 20, 10, 0.08);
    --shadow-sm:  0 2px 8px rgba(30, 20, 10, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Nunito", "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    min-height: 100%;
}

/* Fond par défaut : toutes les pages ont au moins le motif vichy (carreau).
   Les pages spécifiques l'override ci-dessous. */
body {
    min-height: 100vh;
    background-color: var(--bg);
    background-attachment: fixed;
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.82), rgba(255, 247, 240, 0.82)),
        url('/assets/img/patterns/carreau.webp');
    background-repeat: repeat;
    background-size: auto, 240px;
}

body.page-home {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.82), rgba(255, 247, 240, 0.82)),
        url('/assets/img/patterns/carreau.webp');
    background-repeat: repeat;
    background-size: auto, 240px;
}
body.page-final {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.88), rgba(255, 247, 240, 0.88)),
        url('/assets/img/patterns/chat.jpg');
    background-repeat: repeat;
    background-size: auto, 260px;
}
body.page-surprise {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.78), rgba(255, 247, 240, 0.78)),
        url('/assets/img/patterns/rose.jpg');
    background-repeat: repeat;
    background-size: auto, 320px;
}
body[data-pattern="bleu"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.85), rgba(255, 247, 240, 0.85)),
        url('/assets/img/patterns/rayure.webp');
    background-repeat: repeat;
    background-size: auto, 220px;
}
body[data-pattern="rose"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.78), rgba(255, 247, 240, 0.78)),
        url('/assets/img/patterns/rose.jpg');
    background-repeat: repeat;
    background-size: auto, 320px;
}
body[data-pattern="vert"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.78), rgba(255, 247, 240, 0.78)),
        url('/assets/img/patterns/fleur.avif');
    background-repeat: repeat;
    background-size: auto, 300px;
}
body[data-pattern="orange"] {
    background-color: #ffffff;
    background-image: none;
}
body[data-pattern="rouge"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.80), rgba(255, 247, 240, 0.80)),
        url('/assets/img/patterns/tulipes.jpg');
    background-repeat: repeat;
    background-size: auto, 320px;
}

/* Fallback : toute page question avec un slug non prévu → motif fleur */
body.page-question[data-pattern] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.82), rgba(255, 247, 240, 0.82)),
        url('/assets/img/patterns/fleur.avif');
    background-repeat: repeat;
    background-size: auto, 280px;
}
/* Les règles spécifiques (bleu/rose/vert/orange/rouge) reprennent le dessus
   car elles sont plus spécifiques grâce à [data-pattern="X"]. */
body.page-question[data-pattern="bleu"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.85), rgba(255, 247, 240, 0.85)),
        url('/assets/img/patterns/rayure.webp');
    background-size: auto, 220px;
}
body.page-question[data-pattern="rose"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.78), rgba(255, 247, 240, 0.78)),
        url('/assets/img/patterns/rose.jpg');
    background-size: auto, 320px;
}
body.page-question[data-pattern="vert"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.78), rgba(255, 247, 240, 0.78)),
        url('/assets/img/patterns/fleur.avif');
    background-size: auto, 300px;
}
body.page-question[data-pattern="orange"] {
    background-color: #ffffff;
    background-image: none;
}
body.page-question[data-pattern="rouge"] {
    background-image:
        linear-gradient(rgba(255, 247, 240, 0.80), rgba(255, 247, 240, 0.80)),
        url('/assets/img/patterns/tulipes.jpg');
    background-size: auto, 320px;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--ink); }

/* --- Layout ---------------------------------------------------------- */

.shell {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 18px 80px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    margin-bottom: 18px;
}

.card--hero {
    text-align: center;
    padding-top: 44px;
    padding-bottom: 36px;
}

/* --- Typo ------------------------------------------------------------ */

h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

.muted { color: var(--muted); font-size: 14px; }

.hero__title {
    font-size: 34px;
    margin-bottom: 10px;
    color: var(--page-color);
}
.hero__intro {
    color: var(--muted);
    margin-bottom: 22px;
}

/* --- Form ------------------------------------------------------------ */

.form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }

.form--inline { flex-direction: row; flex-wrap: wrap; align-items: center; }

.label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea,
select {
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--page-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--page-color) 25%, transparent);
}

.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }

.error {
    color: #B23A48;
    background: #FCE4E7;
    border: 1px solid #F4B8C0;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 0;
    font-size: 14px;
}

.flash {
    color: #1E6B3C;
    background: #DFF3E3;
    border: 1px solid #B8E0C1;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 0 0 14px;
}

/* --- Buttons --------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .1s, box-shadow .15s, background .15s;
    font-family: inherit;
}
.btn:hover { box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }

.btn--primary {
    background: var(--page-color);
    color: #fff;
    border-color: var(--page-color);
}
.btn--primary:hover { filter: brightness(.95); }

.btn--danger {
    background: #B23A48;
    color: #fff;
    border-color: #B23A48;
}

.btn--sm { padding: 6px 14px; font-size: 14px; }

.hero__sub {
    color: var(--muted);
    font-size: 15px;
    margin: 0 0 16px;
}

/* --- Liste de profils (accueil) -------------------------------------- */

.claim-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.claim-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 14px 18px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    transition: border-color .1s, background .1s, transform .05s;
}
.claim-btn:hover {
    border-color: var(--page-color, var(--rose));
    background: color-mix(in srgb, var(--page-color, var(--rose)) 8%, #fff);
}
.claim-btn:active { transform: translateY(1px); }
.claim-btn__name { font-size: 18px; }
.claim-btn__hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    font-style: italic;
}
.claim-btn--taken { opacity: .7; }

/* --- Badges d'état admin -------------------------------------------- */

.badge-state {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.badge-state--claimed { background: #DFF3E3; color: #1E6B3C; }
.badge-state--free    { background: #F0EBE2; color: var(--muted); }

.rename { display: inline-block; margin-left: 6px; }
.rename__summary { font-size: 11px; cursor: pointer; }
.rename[open] .rename__summary { font-weight: 600; }

/* --- Page question --------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 700;
    color: #fff;
    font-size: 14px;
    letter-spacing: .03em;
    margin-bottom: 14px;
}

.card--question .q__title { color: var(--page-color); }

.q-illustration {
    margin: 18px auto 0;
    padding: 0;
    max-width: 100%;
    display: flex;
    justify-content: center;
}
.q-illustration img {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}
.q__intro {
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 14px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--page-color) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--page-color) 35%, #fff);
    border-radius: var(--radius-sm);
    color: var(--ink);
}

.answers {
    display: grid;
    gap: 10px;
}

.answer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .1s, background .1s;
}
.answer:hover { border-color: var(--page-color); }
.answer input { accent-color: var(--page-color); transform: scale(1.2); }
.answer input:checked + span { font-weight: 600; }
.answer:has(input:checked) {
    border-color: var(--page-color);
    background: color-mix(in srgb, var(--page-color) 10%, #fff);
}

.hint {
    margin-top: 14px;
    background: color-mix(in srgb, var(--page-color) 12%, #fff);
    border: 1px dashed color-mix(in srgb, var(--page-color) 50%, #fff);
    padding: 16px;
    border-radius: var(--radius-sm);
}
.hint__label {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 6px;
    font-weight: 700;
}
.hint__text { margin: 0; font-weight: 600; font-size: 20px; }
.hint__img { margin-top: 12px; border-radius: var(--radius-sm); }

.countdown {
    background: #FFF;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    margin: 14px 0;
}
.countdown__label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.countdown__value { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--page-color); }

/* --- Page final ------------------------------------------------------ */

.progress-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.progress-card {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
    position: relative;
    overflow: hidden;
}
.progress-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: var(--card-color);
}
.progress-card.is-locked { filter: grayscale(1) opacity(.45); }

.progress-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}
.progress-card__dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
}
.progress-card__label { font-weight: 700; }
.progress-card__hint { margin: 6px 0 0; font-size: 15px; font-weight: 600; }
.progress-card__hint--locked { color: var(--muted); font-weight: 400; font-style: italic; }
.progress-card__img { margin-top: 8px; border-radius: 8px; }

.final-question {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px dashed var(--line);
}
.final-question__text { font-size: 19px; font-weight: 600; margin-bottom: 14px; }

/* --- Page surprise --------------------------------------------------- */

.card--surprise { text-align: center; padding: 40px 22px; }
.surprise__title { font-size: 38px; color: var(--rose); margin-bottom: 14px; }
.surprise__img { margin: 16px auto; border-radius: var(--radius-sm); max-height: 360px; object-fit: cover; }
.surprise__text { font-size: 18px; line-height: 1.6; }

/* --- Admin ----------------------------------------------------------- */

body.page-admin {
    background-color: #F7F4EF;
    background-image:
        linear-gradient(rgba(247, 244, 239, 0.92), rgba(247, 244, 239, 0.92)),
        url('/assets/img/patterns/rayure.webp');
    background-repeat: repeat;
    background-size: auto, 200px;
}
.page-admin .shell { max-width: 960px; }

.admin-header {
    background: #111;
    color: #fff;
    padding: 12px 0;
}
.admin-header__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.admin-logo { color: #fff; font-weight: 800; text-decoration: none; font-size: 18px; }
.admin-nav { display: flex; gap: 14px; flex-wrap: wrap; }
.admin-nav a { color: #ddd; text-decoration: none; font-size: 14px; }
.admin-nav a:hover { color: #fff; }

.admin-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.admin-table th, .admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
    vertical-align: middle;
}
.admin-table th { background: #FAF6EF; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.admin-table td.cell-solved { background: #E1F3E3; text-align: center; font-weight: 700; color: #1E6B3C; }
.admin-table td.cell-locked { background: #FFE9D1; text-align: center; color: #B76B1A; }
.admin-table td.cell-tried  { background: #FCE4E7; text-align: center; color: #B23A48; }
.admin-table td.cell-empty  { color: #C7BEB0; text-align: center; }

/* Cellules cliquables (toggle progression / victoire) */
.cell-toggle { padding: 0 !important; }
.cell-form { margin: 0; }
.cell-btn {
    width: 100%;
    min-height: 34px;
    border: none;
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
    padding: 8px 4px;
    transition: filter .1s;
}
.cell-btn:hover { filter: brightness(.9); }
.cell-btn--win { font-size: 18px; }

.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-actions--delete { margin-top: 10px; }

.admin-section {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
    box-shadow: var(--shadow-sm);
}
.admin-section summary { cursor: pointer; }

.admin-question-card {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-top: 18px;
    border-top: 6px solid var(--card-color);
}
.admin-question-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.admin-question-card__header code { background: #F0EBE2; padding: 2px 8px; border-radius: 6px; font-size: 13px; }

.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }

.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.fieldset legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.answer-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.answer-row input[type="text"] { flex: 1; }

.danger-zone {
    margin-top: 30px;
    padding: 20px;
    background: #FDF5F5;
    border: 1px dashed #E8B5BC;
    border-radius: var(--radius-sm);
}
.danger-zone h2 { color: #B23A48; }

/* --- Responsive ------------------------------------------------------ */

@media (max-width: 540px) {
    h1 { font-size: 24px; }
    .hero__title { font-size: 28px; }
    .progress-grid { grid-template-columns: 1fr; }
    .admin-table { font-size: 13px; }
    .admin-table th, .admin-table td { padding: 6px 8px; }
}
