/* Ludo — design system « tapis de jeu ». Mobile d'abord : une colonne "appli" centrée, barre d'onglets en bas. */

:root {
    --felt: #1f4d3a;
    --felt-2: #2c6b50;
    --felt-soft: #e3efe8;
    --cream: #fbf7ef;
    --paper: #fffdf8;
    --orange: #f28c28;
    --orange-dark: #d9731a;
    --orange-soft: #fdebd8;
    --red: #e5484d;
    --red-soft: #fde3e3;
    --yellow: #f5b301;
    --yellow-soft: #fff4cc;
    --blue: #3b6fd8;
    --text: #1d2a24;
    --muted: #74807a;
    --line: #ece4d4;
    --radius: 20px;
    --shadow: 0 6px 22px rgba(31, 77, 58, .08);
    --shadow-strong: 0 14px 34px rgba(31, 77, 58, .2);
    --font-title: 'Bricolage Grotesque', 'Nunito', system-ui, sans-serif;
    --font: 'Nunito', system-ui, sans-serif;
    --tabbar-height: 74px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
    background:
        radial-gradient(circle at 20% 10%, rgba(242, 140, 40, .12), transparent 40%),
        radial-gradient(circle at 80% 90%, rgba(31, 77, 58, .14), transparent 45%),
        #efe7d6 fixed;
}

body {
    margin: 0 auto;
    max-width: 640px;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 16px;
    color: var(--text);
    background: var(--cream);
    padding-bottom: calc(var(--tabbar-height) + 24px + env(safe-area-inset-bottom));
}

@media (min-width: 680px) {
    body { box-shadow: 0 0 60px rgba(31, 77, 58, .14); }
}

a { color: var(--felt-2); }
h1, h2, h3, .title { font-family: var(--font-title); font-weight: 700; letter-spacing: -.02em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* —— En-tête « tapis de jeu » ———————————————————————————————————————— */

.header {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: calc(14px + env(safe-area-inset-top)) 20px 26px;
    border-radius: 0 0 32px 32px;
    background:
        radial-gradient(circle at 90% -10%, rgba(255, 255, 255, .16) 0%, transparent 45%),
        radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px) 0 0 / 6px 6px,
        linear-gradient(155deg, var(--felt) 0%, #17392b 100%);
}

.header::before, .header::after {
    position: absolute;
    pointer-events: none;
    line-height: 1;
    opacity: .12;
    filter: grayscale(1) brightness(3);
}
.header::before { content: '🎲'; font-size: 120px; right: -18px; top: -12px; transform: rotate(18deg); }
.header::after { content: '♟'; font-size: 90px; left: 44%; bottom: -22px; transform: rotate(-12deg); color: #fff; filter: none; opacity: .08; }

.topbar { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; gap: 12px; }
.logo { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-family: var(--font-title); font-size: 1.3rem; font-weight: 800; }
.logo img { width: 32px; height: 32px; border-radius: 10px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center; flex: 0 0 auto;
    background: var(--orange);
    color: #fff; font-family: var(--font-title); font-weight: 800; text-decoration: none;
    border: 2px solid rgba(255, 255, 255, .5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.hello { position: relative; z-index: 1; margin-top: 18px; }
.hello h1 { margin: 0; font-size: 1.7rem; line-height: 1.15; }
.hello p { margin: 6px 0 0; opacity: .85; }

.back { color: #fff; text-decoration: none; font-weight: 800; opacity: .9; }

.pills { display: flex; gap: 8px; margin-top: 16px; position: relative; z-index: 1; flex-wrap: wrap; }
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 99px;
    background: rgba(255, 255, 255, .13);
    color: #fff; text-decoration: none; font-weight: 800; font-size: .88rem;
}

/* —— Contenu ——————————————————————————————————————————————————————— */

.content { padding: 0 16px; }

.toolbar { display: flex; gap: 8px; align-items: center; margin: 18px 0 12px; }
.search {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px;
    padding: 0 14px;
}
.search:focus-within { border-color: var(--felt-2); box-shadow: 0 0 0 4px rgba(44, 107, 80, .12); }
.search input { border: 0; outline: 0; background: transparent; padding: 13px 0; font: inherit; flex: 1; min-width: 0; color: var(--text); }

.icon-btn {
    flex: 0 0 auto; position: relative;
    width: 48px; height: 48px; border-radius: 16px;
    display: grid; place-items: center;
    background: var(--paper); border: 1.5px solid var(--line);
    font-size: 1.2rem; cursor: pointer; color: var(--text); text-decoration: none;
}
.icon-btn.active { background: var(--felt); border-color: var(--felt); color: #fff; }
.icon-btn .count {
    position: absolute; top: -6px; right: -6px;
    min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
    background: var(--orange); color: #fff; font-size: .72rem; font-weight: 800;
    display: grid; place-items: center;
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 99px;
    background: var(--paper); border: 1.5px solid var(--line);
    color: var(--text); text-decoration: none; font: inherit; font-weight: 800; font-size: .9rem;
    cursor: pointer; user-select: none;
    transition: transform .1s, background .15s;
}
.chip:active { transform: scale(.95); }
.chip .n { color: var(--muted); font-weight: 700; font-size: .8rem; }
.chip.active, input:checked + .chip { background: var(--felt); border-color: var(--felt); color: #fff; }
.chip.active .n, input:checked + .chip .n { color: rgba(255, 255, 255, .7); }
input.sr { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
input.sr:focus-visible + .chip, input.sr:focus-visible + .tile, input.sr:focus-visible + label { outline: 3px solid var(--orange); outline-offset: 2px; }

.section { display: flex; align-items: baseline; gap: 8px; margin: 26px 4px 12px; }
.section h2 { margin: 0; font-size: 1.2rem; }
.section .count { color: var(--muted); font-weight: 800; }
.section .end { margin-left: auto; font-weight: 800; font-size: .9rem; text-decoration: none; }

.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 4px 10px; font-weight: 800; color: var(--muted); font-size: .9rem; }
.result-bar select {
    border: 0; background: transparent; font: inherit; font-weight: 800; color: var(--felt);
    text-align: right; cursor: pointer; padding: 4px 0;
}

/* —— Boîtes de jeu (vue étagère) ——————————————————————————————————— */

.shelf { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
@media (min-width: 440px) { .shelf { grid-template-columns: repeat(3, 1fr); } }

.box { display: block; color: inherit; text-decoration: none; animation: pop .3s ease-out both; }
.box:nth-child(3n+2) { animation-delay: .03s; }
.box:nth-child(3n) { animation-delay: .06s; }
.box-name { font-weight: 800; line-height: 1.2; margin: 9px 2px 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.box-meta { font-size: .8rem; color: var(--muted); font-weight: 700; margin: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.art {
    --h: 140;
    position: relative; overflow: hidden;
    aspect-ratio: 1;
    border-radius: 16px;
    background: linear-gradient(140deg, hsl(var(--h) 62% 56%), hsl(calc(var(--h) + 35) 58% 34%));
    box-shadow: 0 2px 0 rgba(0, 0, 0, .06), 6px 8px 0 -2px rgba(31, 77, 58, .1), var(--shadow);
    transition: transform .2s;
    display: grid; place-items: center;
}
.box:hover .art, .box:focus-visible .art { transform: rotate(-2deg) translateY(-3px); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art::after { /* le couvercle : un liseré clair en haut et une ombre en bas, comme une vraie boîte */
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, .25), inset 0 -10px 18px rgba(0, 0, 0, .12);
}
.art .initials {
    font-family: var(--font-title); font-weight: 800; color: #fff;
    font-size: 2.6rem; letter-spacing: -.04em;
    text-shadow: 0 3px 0 rgba(0, 0, 0, .15);
    position: relative; z-index: 1;
}
.art .mark { position: absolute; right: -6px; bottom: -10px; font-size: 3.6rem; opacity: .35; transform: rotate(-14deg); }
.art .ribbon { position: absolute; left: 0; right: 0; top: 18%; height: 18%; background: rgba(255, 255, 255, .1); transform: skewY(-8deg); }

.badges { position: absolute; z-index: 2; left: 7px; right: 7px; top: 7px; display: flex; justify-content: space-between; gap: 4px; pointer-events: none; }
.badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px; border-radius: 99px;
    background: rgba(255, 253, 248, .94); color: var(--text);
    font-size: .74rem; font-weight: 800;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.badge.lent { background: var(--orange); color: #fff; }
.badge.new { background: var(--yellow); }

/* —— Vue liste ——————————————————————————————————————————————————————— */

.rows { display: flex; flex-direction: column; gap: 10px; }
.game-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--paper); border-radius: var(--radius);
    padding: 10px; color: inherit; text-decoration: none;
    box-shadow: var(--shadow);
    animation: pop .25s ease-out both;
}
.game-row .art { width: 64px; flex: 0 0 64px; border-radius: 13px; box-shadow: var(--shadow); }
.game-row .art .initials { font-size: 1.3rem; }
.game-row .art .mark { font-size: 1.8rem; }
.game-row .grow { flex: 1; min-width: 0; }
.game-row .name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-row .sub { font-size: .82rem; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts-inline { display: flex; gap: 10px; font-size: .8rem; font-weight: 800; margin-top: 4px; color: var(--text); flex-wrap: wrap; }

/* —— Étoiles ————————————————————————————————————————————————————————— */

.stars { display: inline-flex; gap: 1px; font-size: .95rem; line-height: 1; letter-spacing: 0; }
.star { position: relative; color: #e2d9c6; }
.star.full { color: var(--yellow); }
.star.half { background: linear-gradient(90deg, var(--yellow) 50%, #e2d9c6 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.rate { display: flex; flex-wrap: nowrap; gap: 4px; }
.rate .star-btn { display: inline-grid; place-items: center; position: relative; width: 40px; height: 40px; font-size: 2.1rem; line-height: 1; }
.rate .star-btn button {
    position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1;
    border: 0; background: transparent; cursor: pointer; padding: 0;
}
.rate .star-btn button:first-of-type { left: 0; }
.rate .star-btn button:last-of-type { right: 0; }
.rate .star-btn button:focus-visible { outline: 2px solid var(--orange); border-radius: 6px; }

/* —— Boutons ——————————————————————————————————————————————————————— */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 20px; border: 0; border-radius: 16px;
    background: var(--orange); color: #fff;
    font-family: var(--font-title); font-weight: 700; font-size: 1.05rem;
    text-decoration: none; cursor: pointer;
    box-shadow: 0 5px 0 var(--orange-dark), 0 10px 18px rgba(242, 140, 40, .3);
    transition: transform .1s, box-shadow .1s, background .2s;
}
.btn:hover { background: #f59a3e; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--orange-dark), 0 4px 10px rgba(242, 140, 40, .25); }
.btn.block { width: 100%; }
.btn.small { padding: 10px 14px; font-size: .95rem; border-radius: 13px; }
.btn.ghost { background: var(--felt-soft); color: var(--felt); box-shadow: none; }
.btn.ghost:active { transform: scale(.97); }
.btn.felt { background: var(--felt); box-shadow: 0 5px 0 #133126, 0 10px 18px rgba(31, 77, 58, .3); }
.btn.felt:active { box-shadow: 0 2px 0 #133126; }
.btn.danger { background: var(--red-soft); color: var(--red); box-shadow: none; }

.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--felt-2); cursor: pointer; text-decoration: underline; }

/* —— Barre d'onglets ——————————————————————————————————————————————— */

.tabbar {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 640px; z-index: 30;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    padding: 0 8px env(safe-area-inset-bottom);
    background: rgba(255, 253, 248, .93);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    display: grid; grid-template-columns: 1fr 1fr 88px 1fr 1fr; align-items: center;
}
.tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 800;
}
.tab .icon { font-size: 1.35rem; line-height: 1; filter: grayscale(1); opacity: .65; transition: .2s; }
.tab.active { color: var(--felt); }
.tab.active .icon { filter: none; opacity: 1; transform: translateY(-2px) scale(1.08); }
.tab-add {
    justify-self: center;
    width: 64px; height: 64px; margin-top: -30px; border-radius: 22px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, #f7a24d, var(--orange-dark));
    color: #fff; font-size: 2.2rem; font-weight: 300; line-height: 1; text-decoration: none;
    box-shadow: 0 10px 24px rgba(242, 140, 40, .45);
    border: 4px solid var(--cream);
    transform: rotate(-6deg);
    transition: transform .15s;
}
.tab-add:hover { transform: rotate(0); }
.tab-add:active { transform: scale(.92) rotate(90deg); }

/* —— Toasts ———————————————————————————————————————————————————————— */

.toasts {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-height) + 14px + env(safe-area-inset-bottom));
    width: calc(100% - 24px); max-width: 616px; z-index: 40;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-radius: 16px;
    background: var(--felt); color: #fff; font-weight: 800;
    box-shadow: var(--shadow-strong);
    animation: toast-in .3s ease-out both;
}
.toast.error { background: var(--red); }
.toast.confetti { background: linear-gradient(120deg, var(--orange), var(--red)); }
.toast.leaving { animation: toast-out .3s ease-in both; }

.confetti-piece {
    position: fixed; top: -12px; z-index: 50; width: 9px; height: 14px; border-radius: 2px;
    pointer-events: none; animation: confetti 2.4s cubic-bezier(.25, .6, .4, 1) forwards;
}

/* —— Formulaires ——————————————————————————————————————————————————— */

.card { background: var(--paper); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h2 { margin: 0 0 12px; font-size: 1.15rem; }

.step { margin: 24px 0; }
.step-title { display: flex; align-items: center; gap: 10px; margin: 0 4px 12px; font-family: var(--font-title); font-size: 1.15rem; font-weight: 700; }
.step-title .num {
    width: 28px; height: 28px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--felt); color: #fff; font-size: .9rem;
    transform: rotate(-6deg);
}
.step-title .hint { margin-left: auto; font-family: var(--font); font-size: .82rem; color: var(--muted); font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 480px) { .tiles { grid-template-columns: repeat(5, 1fr); } }
.tile {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
    padding: 12px 4px 10px; border-radius: 18px;
    background: var(--paper); border: 2px solid transparent; box-shadow: var(--shadow);
    text-align: center; font-size: .72rem; font-weight: 800; line-height: 1.15; color: var(--text);
    cursor: pointer; user-select: none; height: 100%;
    transition: transform .12s, border-color .15s, background .15s;
}
.tile .emoji { font-size: 1.8rem; line-height: 1; transition: transform .2s; }
.tile:active { transform: scale(.94); }
input:checked + .tile { border-color: var(--tile-color, var(--felt)); background: color-mix(in srgb, var(--tile-color, var(--felt)) 12%, white); }
input:checked + .tile .emoji { transform: scale(1.18) rotate(-8deg); }

.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=date], .field input[type=number], .field input[type=url], .field input[type=search], .field select, .field textarea {
    width: 100%; padding: 14px 16px;
    border: 1.5px solid var(--line); border-radius: 16px;
    background: var(--paper); font: inherit; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--felt-2); box-shadow: 0 0 0 4px rgba(44, 107, 80, .14); }
.input.big { font-family: var(--font-title); font-size: 1.3rem; font-weight: 700; padding: 16px 18px; }

.field { margin-bottom: 14px; }
.field > label, .field .label { display: block; margin: 0 4px 6px; font-weight: 800; font-size: .9rem; }
.field .help, .help { color: var(--muted); font-size: .82rem; margin: 5px 4px 0; }
.field ul, .errors { color: var(--red); font-weight: 800; font-size: .88rem; margin: 6px 4px 0; padding: 0; list-style: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
    width: 48px; height: 48px; border-radius: 15px; border: 0; cursor: pointer;
    background: var(--felt-soft); color: var(--felt); font-size: 1.5rem; font-weight: 800;
    transition: transform .1s;
}
.stepper button:active { transform: scale(.9); }
.stepper input {
    width: 64px; text-align: center; font-family: var(--font-title); font-size: 1.9rem; font-weight: 800;
    border: 0; background: transparent; color: var(--text); -moz-appearance: textfield; padding: 0;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.players-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; background: var(--paper); border-radius: 20px; padding: 12px; box-shadow: var(--shadow); }
.players-range .sep { font-weight: 800; color: var(--muted); }

.segmented { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; background: var(--felt-soft); border-radius: 16px; padding: 4px; gap: 4px; }
.segmented label { display: block; padding: 11px 6px; text-align: center; border-radius: 12px; font-weight: 800; font-size: .88rem; cursor: pointer; color: var(--felt); }
.segmented input:checked + label { background: var(--paper); box-shadow: var(--shadow); }

.weights { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.weights label {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 2px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow);
    font-size: .7rem; font-weight: 800; text-align: center; cursor: pointer; border: 2px solid transparent;
}
.weights input:checked + label { border-color: var(--felt); background: var(--felt-soft); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #ddd3bf; }
.dots i.on { background: var(--felt-2); }

.drop, .field > label.drop {
    display: flex; margin: 0; align-items: center; gap: 12px;
    padding: 14px; border-radius: 18px; border: 2px dashed var(--line); background: var(--paper);
    cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.has-file { border-color: var(--felt-2); background: var(--felt-soft); }
.drop .preview { width: 56px; height: 56px; border-radius: 12px; flex: 0 0 auto; display: grid; place-items: center; font-size: 1.8rem; background: var(--felt-soft); overflow: hidden; }
.drop .preview img { width: 100%; height: 100%; object-fit: cover; }
.drop .grow { flex: 1; min-width: 0; }
.drop .grow strong { display: block; }
.drop .grow span { color: var(--muted); font-size: .85rem; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.details { background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); margin: 16px 0; }
.details summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; gap: 10px; }
.details summary::-webkit-details-marker { display: none; }
.details summary .title { font-size: 1.02rem; }
.details summary .recap { color: var(--muted); font-size: .85rem; margin-top: 2px; font-weight: 700; }
.details summary .chevron { margin-left: auto; transition: transform .2s; color: var(--muted); font-weight: 800; }
.details[open] summary .chevron { transform: rotate(180deg); }
.details .inner { padding: 0 18px 18px; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 800; margin: 4px 4px 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--felt); }

.actions-bar {
    position: sticky; bottom: calc(var(--tabbar-height) + 10px + env(safe-area-inset-bottom));
    display: flex; gap: 10px; z-index: 5;
    margin: 0 -16px; padding: 22px 16px 10px;
    background: linear-gradient(to top, var(--cream) 65%, rgba(251, 247, 239, 0));
}
.actions-bar .btn { flex: 1; }

/* —— Fiche jeu ———————————————————————————————————————————————————— */

.hero { position: relative; margin-top: -60px; display: flex; gap: 16px; align-items: flex-end; z-index: 2; }
.hero .art { width: 140px; flex: 0 0 140px; border-radius: 20px; box-shadow: var(--shadow-strong); transform: rotate(-3deg); }
.hero .art .initials { font-size: 3rem; }
.hero .grow { flex: 1; min-width: 0; padding-bottom: 6px; }
.hero .stars { font-size: 1.3rem; }
.header.with-hero { padding-bottom: 80px; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 20px 0 6px; }
.fact { background: var(--paper); border-radius: 16px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); }
.fact .emoji { font-size: 1.35rem; line-height: 1; }
.fact .value { font-family: var(--font-title); font-weight: 800; font-size: 1.05rem; margin-top: 5px; white-space: nowrap; }
.fact .label { font-size: .7rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

.genre-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.genre-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; border-radius: 99px; text-decoration: none;
    background: color-mix(in srgb, var(--c, var(--felt)) 13%, white);
    color: color-mix(in srgb, var(--c, var(--felt)) 80%, black);
    font-weight: 800; font-size: .85rem;
}

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.actions .btn { padding: 13px 10px; font-size: .98rem; }
.actions form { display: contents; }

.counter {
    display: flex; align-items: center; gap: 16px;
    background: linear-gradient(135deg, var(--felt-2), var(--felt));
    color: #fff; border-radius: 24px; padding: 18px 20px; box-shadow: var(--shadow-strong);
    position: relative; overflow: hidden;
}
.counter::after { content: '🏆'; position: absolute; right: -6px; bottom: -14px; font-size: 90px; opacity: .14; transform: rotate(-12deg); }
.counter .big { font-family: var(--font-title); font-size: 3rem; font-weight: 800; line-height: 1; }
.counter .label { font-weight: 800; opacity: .9; }
.counter .sub { opacity: .8; font-size: .88rem; font-weight: 700; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--paper); border-radius: 18px; margin-bottom: 8px; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .sub { color: var(--muted); font-size: .84rem; font-weight: 700; }
.list-row form { margin: 0; }
.bubble {
    flex: 0 0 auto;
    width: 44px; height: 44px; border-radius: 14px;
    display: grid; place-items: center;
    font-size: 1.4rem; line-height: 1;
    background: var(--felt-soft);
}

.note-card { background: var(--yellow-soft); border-radius: 18px; padding: 14px 16px; white-space: pre-line; transform: rotate(-.6deg); box-shadow: var(--shadow); }

.player-chips label.chip { padding: 9px 14px; }
.winner-chips input:checked + .chip { background: var(--yellow); border-color: var(--yellow); color: var(--text); }

/* —— Compteur de points ————————————————————————————————————————————— */

.timer { font-family: var(--font-title); font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.score-card {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
    background: var(--paper); border-radius: 22px; padding: 14px 16px; margin-bottom: 10px;
    box-shadow: var(--shadow); border: 2px solid transparent;
    transition: border-color .2s, transform .2s;
}
.score-card.leader { border-color: var(--yellow); }
.score-card .who { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; min-width: 0; }
.score-card .who .crown { display: none; font-size: 1.2rem; animation: bounce .6s ease-out; }
.score-card.leader .who .crown { display: inline; }
.score-card .who .rank { width: 24px; height: 24px; border-radius: 8px; background: var(--felt-soft); color: var(--felt); font-size: .8rem; display: grid; place-items: center; flex: 0 0 auto; }
.score-card .points { font-family: var(--font-title); font-weight: 800; font-size: 2.2rem; text-align: right; min-width: 70px; font-variant-numeric: tabular-nums; border: 0; background: transparent; color: var(--text); padding: 0; width: 110px; }
.score-card .points:focus { outline: 0; background: var(--felt-soft); border-radius: 10px; }
.score-card .buttons { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr) 40px; gap: 6px; }
.score-card .buttons button {
    height: 46px; border-radius: 14px; border: 0; cursor: pointer;
    font-family: var(--font-title); font-weight: 800; font-size: 1.05rem;
    background: var(--felt-soft); color: var(--felt);
    transition: transform .08s;
}
.score-card .buttons button.plus { background: var(--felt); color: #fff; }
.score-card .buttons button.remove { background: transparent; color: var(--muted); font-size: 1.1rem; }
.score-card .buttons button:active { transform: scale(.9); }
.score-card.bump .points { animation: bump .25s ease-out; }

/* —— Ce soir ————————————————————————————————————————————————————————— */

.dice-btn {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
    border: 0; border-radius: 22px; padding: 18px; cursor: pointer;
    background: linear-gradient(135deg, var(--red), #c2303a); color: #fff;
    font-family: var(--font-title); font-weight: 800; font-size: 1.3rem;
    box-shadow: 0 6px 0 #9e2530, 0 14px 26px rgba(229, 72, 77, .35);
}
.dice-btn .die { font-size: 2rem; display: inline-block; }
.dice-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #9e2530; }
.dice-btn.rolling .die { animation: roll .5s linear infinite; }

.pick-overlay {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(23, 57, 43, .82); backdrop-filter: blur(6px);
    display: grid; place-items: center; padding: 24px;
    animation: fade .2s ease-out both;
}
.pick-card { width: min(320px, 100%); text-align: center; color: #fff; }
.pick-card .art { width: 220px; margin: 0 auto 18px; border-radius: 26px; box-shadow: 0 20px 50px rgba(0, 0, 0, .4); }
.pick-card .art .initials { font-size: 4rem; }
.pick-card h2 { font-size: 1.8rem; margin: 0 0 6px; }
.pick-card.done .art { animation: land .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.pick-card .btns { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

.reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reasons span { font-size: .74rem; font-weight: 800; padding: 3px 8px; border-radius: 99px; background: var(--felt-soft); color: var(--felt); }

/* —— Envies ———————————————————————————————————————————————————————— */

.wish { background: var(--paper); border-radius: 22px; padding: 12px; box-shadow: var(--shadow); margin-bottom: 12px; animation: pop .25s ease-out both; }
.wish .top { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.wish .art { width: 72px; flex: 0 0 72px; border-radius: 14px; }
.wish .art .initials { font-size: 1.5rem; }
.wish .art .mark { font-size: 2rem; }
.wish .grow { flex: 1; min-width: 0; }
.wish .hearts { font-size: .9rem; letter-spacing: -2px; }
.wish .price { font-family: var(--font-title); font-weight: 800; font-size: 1.15rem; color: var(--felt); white-space: nowrap; }
.wish .bottom { display: flex; gap: 8px; margin-top: 10px; }
.wish .bottom > * { flex: 1; }
.wish .bottom form { display: flex; }
.wish .bottom .btn { width: 100%; }

/* —— Stats ————————————————————————————————————————————————————————— */

.tiles-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
@media (min-width: 480px) { .tiles-stats { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--paper); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat .value { font-family: var(--font-title); font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.stat .label { color: var(--muted); font-weight: 800; font-size: .82rem; }
.stat .emoji { position: absolute; right: 10px; top: 10px; font-size: 1.4rem; opacity: .9; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 28px; align-items: center; gap: 10px; font-weight: 800; font-size: .88rem; }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar-row .track span { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--felt)); transform-origin: left; animation: grow .7s ease-out both; }
.bar-row .n { text-align: right; color: var(--muted); }


/* —— Divers ———————————————————————————————————————————————————————— */

.empty { text-align: center; padding: 36px 20px; }
.empty .big { font-size: 3.4rem; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
.empty h2 { margin: 0 0 6px; }

.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.auth .brand { text-align: center; margin-bottom: 26px; }
.auth .brand img { width: 88px; height: 88px; border-radius: 26px; box-shadow: var(--shadow-strong); animation: float 4s ease-in-out infinite; }
.auth .brand h1 { margin: 14px 0 2px; font-size: 2.2rem; color: var(--felt); }

@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(14px); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes roll { to { transform: rotate(360deg); } }
@keyframes land { from { transform: scale(.6) rotate(-20deg); } }
@keyframes bounce { 40% { transform: translateY(-6px) scale(1.2); } }
@keyframes bump { 50% { transform: scale(1.15); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes confetti { to { transform: translate3d(var(--dx), 105vh, 0) rotate(var(--r)); } }

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

/* Vue étagère / liste, choisie dans la ludothèque et gardée en localStorage (cf. game/index.html.twig). */
.rows { display: none; }
[data-view=list] .shelf { display: none; }
[data-view=list] .rows { display: flex; }

/* —— Scanner ———————————————————————————————————————————————————————— */

.scanner {
    position: relative; overflow: hidden; margin-top: 18px;
    aspect-ratio: 3 / 4; max-height: 62vh; width: 100%;
    border-radius: 26px; background: #17392b; box-shadow: var(--shadow-strong);
    cursor: pointer;
}
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
    position: absolute; left: 12%; right: 12%; top: 34%; height: 28%;
    border-radius: 18px; opacity: 0; transition: opacity .3s, box-shadow .2s;
    box-shadow: 0 0 0 999px rgba(23, 57, 43, .45);
    background:
        linear-gradient(#fff, #fff) top left / 28px 4px no-repeat, linear-gradient(#fff, #fff) top left / 4px 28px no-repeat,
        linear-gradient(#fff, #fff) top right / 28px 4px no-repeat, linear-gradient(#fff, #fff) top right / 4px 28px no-repeat,
        linear-gradient(#fff, #fff) bottom left / 28px 4px no-repeat, linear-gradient(#fff, #fff) bottom left / 4px 28px no-repeat,
        linear-gradient(#fff, #fff) bottom right / 28px 4px no-repeat, linear-gradient(#fff, #fff) bottom right / 4px 28px no-repeat;
}
.scanner.live .scanner-frame { opacity: 1; }
.scanner.found .scanner-frame { box-shadow: 0 0 0 999px rgba(44, 107, 80, .75); }
.laser { position: absolute; left: 6%; right: 6%; top: 50%; height: 3px; border-radius: 3px; background: var(--red); box-shadow: 0 0 12px var(--red); animation: laser 1.6s ease-in-out infinite alternate; }
.scanner-message {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    color: #fff; text-align: center; padding: 24px;
}
.scanner-message .big { font-size: 3.4rem; animation: float 3s ease-in-out infinite; }
.scanner-message strong { font-family: var(--font-title); font-size: 1.3rem; }
.scanner-message span:last-child { opacity: .85; font-weight: 700; }
.scanner-torch {
    position: absolute; right: 14px; bottom: 14px; width: 48px; height: 48px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .2); font-size: 1.3rem; cursor: pointer;
}
.scanner-torch.on { background: var(--yellow); }

.scan-cta, .scan-found {
    display: flex; align-items: center; gap: 12px; margin-top: 18px;
    padding: 14px 16px; border-radius: 20px; text-decoration: none; color: var(--text);
}
.scan-cta { background: var(--paper); box-shadow: var(--shadow); border: 2px dashed var(--felt-2); }
.scan-cta .icon, .scan-found .icon { font-size: 1.8rem; }
.scan-cta .grow { flex: 1; min-width: 0; }
.scan-cta .grow strong { display: block; font-family: var(--font-title); font-size: 1.1rem; }
.scan-cta .grow span { color: var(--muted); font-size: .86rem; font-weight: 700; }
.scan-found { background: var(--yellow-soft); font-weight: 800; }

.candidate .art { background: var(--felt-soft); }
.candidate .art img { object-fit: contain; }
.candidate .btn { flex: 0 0 auto; }

@keyframes laser { from { top: 12%; } to { top: 85%; } }

/* —— Les notes de chacun ————————————————————————————————————————————— */

.ratings-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ratings-head h2 { margin: 0; }
.verdict { padding: 5px 11px; border-radius: 99px; background: var(--felt-soft); color: var(--felt); font-weight: 800; font-size: .85rem; white-space: nowrap; }
.verdict.disputed { background: var(--red-soft); color: var(--red); animation: shake .5s ease-in-out 1; }
.verdict.unanimous { background: #fde7f1; color: #be185d; }
.rating-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; margin: 0; }
.rating-row + .rating-row { border-top: 1px solid var(--line); }
.who-avatar {
    --h: 30;
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
    display: grid; place-items: center;
    background: hsl(var(--h) 70% 52%); color: #fff;
    font-family: var(--font-title); font-weight: 800;
}
.who-name { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-name small { color: var(--muted); font-weight: 700; }
.rating-row .rate { gap: 0; flex: 0 0 auto; }
.rating-row .rate .star-btn { width: 30px; height: 34px; font-size: 1.6rem; }
.rating-row .value { width: 24px; text-align: right; font-family: var(--font-title); font-weight: 800; color: var(--muted); }
.rating-row .clear { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; font-size: .9rem; }

.mini-ratings { font-size: .78rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.mini-ratings b { color: var(--text); }
.mini-ratings.disputed b { color: var(--red); }

.critics { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.critic { display: flex; align-items: center; gap: 10px; }
.critic > div { flex: 1; min-width: 0; }
.critic .sub { color: var(--muted); font-size: .84rem; font-weight: 700; }
.critic .tag { font-size: .8rem; font-weight: 800; white-space: nowrap; }
.mini-title { font-size: 1rem; margin: 16px 0 8px; }
.dispute { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.dispute .name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes shake { 20%, 60% { transform: rotate(-4deg); } 40%, 80% { transform: rotate(4deg); } }

.scan-box { margin-top: 18px; }
.scan-box .scan-cta { margin-top: 0; }
.ean-inline { display: flex; gap: 8px; margin-top: 10px; }
.ean-inline .input { flex: 1; min-width: 0; padding: 11px 14px; font-variant-numeric: tabular-nums; }
.ean-more { display: inline-block; margin: 10px 4px 0; font-weight: 800; font-size: .88rem; }

.scan-series {
    display: flex; align-items: center; gap: 10px; margin-top: 12px;
    padding: 12px 14px; border-radius: 18px; background: var(--paper); box-shadow: var(--shadow);
}
.scan-series .grow { flex: 1; min-width: 0; font-weight: 800; }
.scan-series .codes { color: var(--muted); font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.scan-found.twin { flex-wrap: wrap; }
.scan-found.twin .grow { flex: 1; min-width: 180px; }

/* —— Parties d'avant —————————————————————————————————————————————————— */

.history-year { display: flex; align-items: center; gap: 8px; margin: 18px 0 12px; }
.history-year label { font-weight: 800; }
.history-year select { flex: 1; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); font: inherit; font-weight: 800; }
.history-row .art { width: 48px; flex-basis: 48px; }
.mini-stepper { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.mini-stepper button { width: 34px; height: 34px; border-radius: 11px; border: 0; background: var(--felt-soft); color: var(--felt); font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.mini-stepper input { width: 52px; text-align: center; border: 1.5px solid var(--line); border-radius: 11px; padding: 6px 2px; font-family: var(--font-title); font-weight: 800; font-size: 1.05rem; background: var(--paper); -moz-appearance: textfield; }
.mini-stepper input::-webkit-outer-spin-button, .mini-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mini-stepper input:not(:placeholder-shown) { border-color: var(--felt-2); background: var(--felt-soft); }
