/* ═══════════════════════════════════════════════════════════════════════════
   Reset CSS – Eric Meyer v2.0 + box-sizing
   ═══════════════════════════════════════════════════════════════════════════ */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
    display: block;
}

body {
    line-height: 1;
}

ol,
ul {
    list-style: none;
}

blockquote,
q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

* {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════════════
   La Linotte DELUX – Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
    --bg: #0f0e17;
    --bg2: #1a1830;
    --bg3: #252344;
    --surface: #2a2850;
    --border: #3d3a6e;
    --text: #fffffe;
    --muted: #a7a9be;
    --accent: #ff6b6b;
    --accent2: #ffe66d;

    /* Layout */
    --header-h: 3.5em;
    --layout-pad: 1.143em;
    --sidebar-w: 20em;
    --layout-gap: 1.143em;

    /* Typographie */
    --font-system: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, Cantarell, Helvetica, Arial, sans-serif;

    /* Couleurs joueurs */
    --p0: #e74c3c;
    --p1: #3498db;
    --p2: #2ecc71;
    --p3: #f39c12;

}

/* ─── Tailles des labels de cases (à ajuster ici) ────────────────────────── */
:root {
    --cell-font-scale: 0.18;
    /* facteur global — augmenter = tout plus grand */

    --fs-numbered: 2.143em;
    --fs-small: 1.2em;
    --fs-big: 1.7em;
    --fs-full: 1.6em;
    --fs-petite-quinte: 1em;
    --fs-grande-quinte: 1em;
    --fs-appel: 1.15em;
    --fs-parite: 1.1em;
    --fs-sec: 1.286em;
    --fs-chance: 1em;
    --fs-carre: 1.143em;
    --fs-yam: 1.5em;
}

/* ─── Reset & base ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'IM Fell English', serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 16.8px;
}

h1,
h2,
h3 {
    font-family: 'IM Fell English', serif;
}

#lang-picker {
    background: #0d0b18;
    border: 0.071em solid #3a3060;
    border-radius: 0.571em;
    color: var(--text);
    padding: 0.5em 2em 0.5em 0.857em;
    font-family: "Twemoji Country Flags", 'IM Fell English', serif;
    font-size: 1em;
    outline: none;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
    box-shadow: inset 0 0.1em 0.4em rgba(0, 0, 0, .5);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a7a9be' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75em center;
    margin-bottom: 0.857em;
}

#lang-picker:focus {
    border-color: #ffe66d88;
    box-shadow: inset 0 0.1em 0.4em rgba(0, 0, 0, .5), 0 0 0.5em #ffe66d33;
}

#lang-picker option {
    background: #1a1830;
}

input[type="text"],
input[type="number"] {
    background: #0d0b18;
    border: 0.071em solid #3a3060;
    border-radius: 0.571em;
    color: var(--text);
    padding: 0.714em 1em;
    font-family: 'IM Fell English', serif;
    font-size: 1em;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-shadow: inset 0 0.1em 0.4em rgba(0, 0, 0, .5);
}

input:focus {
    border-color: #ffe66d88;
    box-shadow: inset 0 0.1em 0.4em rgba(0, 0, 0, .5), 0 0 0.5em #ffe66d33;
}

button {
    cursor: pointer;
    font-family: 'IM Fell English', serif;
    border: none;
}

/* ─── Utilitaires ─────────────────────────────────────────────────────────── */
.screen {
    display: none;
}

.screen.active {
    display: flex;
}

.input-tip {
    display: block;
    color: var(--muted);
    font-size: .8em;
    margin-top: -0.4em;
    margin-bottom: 0.5em;
    font-style: italic;
}

.muted {
    color: var(--muted);
    font-size: .9em;
}

.error-msg {
    color: #ff6b6b;
    font-size: .9em;
    margin-top: 0.429em;
}

/* ─── Boutons ─────────────────────────────────────────────────────────────── */
.btn {
    padding: 0.714em 1.571em;
    border-radius: 0.3em;
    font-size: 1em;
    font-weight: 700;
    transition: transform .15s, box-shadow .15s, opacity .15s;
}

.btn:hover:not(:disabled) {
    transform: translateY(-0.143em);
    box-shadow: 0 0.286em 0.857em rgba(0, 0, 0, .4);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #c67c2a 0%, #e8a020 50%, #c67c2a 100%);
    background-size: 200% 100%;
    color: #1a0f00;
    font-weight: 800;
    border: 0.071em solid #ffe66d55;
    box-shadow: 0 0.2em 0.8em #c67c2a55, inset 0 0.071em 0 #ffe66d66;
    transition: transform .15s, box-shadow .15s, background-position .3s;
}

.btn-primary:hover:not(:disabled) {
    background-position: 100% 0;
    box-shadow: 0 0.3em 1.2em #c67c2a88, inset 0 0.071em 0 #ffe66d88;
}

.btn-secondary {
    background: linear-gradient(135deg, rgb(160, 120, 32), rgb(245, 200, 66));
    color: #fff;
    text-shadow: 0 1px 3px rgba(80, 35, 0, 0.75), 0 -1px 0 rgba(255, 240, 160, 0.25);
    border: 1px solid rgba(255, 224, 102, 0.8);
    box-shadow: rgba(245, 185, 40, 0.4) 0px 0px 12px, rgb(255, 220, 80) 0px 0px 4px;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgb(100, 75, 20), rgb(180, 145, 40));
    border-color: rgba(255, 224, 102, 0.43);
    box-shadow: rgba(245, 185, 40, 0.15) 0px 0px 8px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(80, 35, 0, 0.9), 0 -1px 0 rgba(255, 240, 160, 0.15);
}

.btn-debug {
    background: transparent;
    color: var(--muted);
    border: 0.071em dashed var(--border);
    font-size: .85em;
    margin-top: 0.429em;
}

#debug-panel {
    border-radius: 0.714em;
    padding: 0.714em;
    margin-top: 0.571em;
}

#debug-panel h3 {
    font-size: .85em;
    color: var(--muted);
    margin-bottom: 0.571em;
}

#debug-dice-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.429em;
    margin-bottom: 0.429em;
}

.debug-die-input {
    width: 5em;
    text-align: center;
    background: var(--bg3);
    border: 0.071em solid var(--border);
    border-radius: 0.429em;
    color: var(--text);
    padding: 0.286em;
    font-size: .9em;
}

#debug-panel .btn-debug {
    width: 100%;
}

.btn-roll {
    background: linear-gradient(135deg, rgb(160, 120, 32), rgb(245, 200, 66));
    color: #fff;
    text-shadow: 0 1px 3px rgba(80, 35, 0, 0.75), 0 -1px 0 rgba(255, 240, 160, 0.25);
    border: 1px solid rgba(255, 224, 102, 0.8);
    box-shadow: rgba(245, 185, 40, 0.4) 0px 0px 12px, rgb(255, 220, 80) 0px 0px 4px;
    width: 100%;
    margin-bottom: 0.429em;
}

.btn-roll:hover:not(:disabled) {
    border-color: rgba(255, 224, 102, 0.43);
    box-shadow: rgba(245, 185, 40, 0.15) 0px 0px 8px;
}

.btn-silver {
    background: linear-gradient(135deg, rgb(110, 120, 140), rgb(200, 215, 235));
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 10, 30, 0.7), 0 -1px 0 rgba(230, 245, 255, 0.3);
    border: 1px solid rgba(210, 230, 255, 0.35);
    box-shadow: rgba(170, 195, 235, 0.2) 0px 0px 8px;
}

.btn-silver:hover:not(:disabled) {
    background: linear-gradient(135deg, rgb(70, 78, 95), rgb(140, 155, 180));
    border-color: rgba(210, 230, 255, 0.43);
    box-shadow: rgba(170, 195, 235, 0.15) 0px 0px 8px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 10, 30, 0.85), 0 -1px 0 rgba(230, 245, 255, 0.2);
}

.btn-pass {
    background: linear-gradient(135deg, #0a0f1c 0%, #162540 30%, #2a2250 60%, #0e1128 100%);
    color: #7a9cc4;
    border: 1px solid rgba(100, 140, 210, 0.25);
    box-shadow: inset 0 1px 0 rgba(140, 180, 240, 0.12), 0 2px 10px rgba(0, 0, 0, 0.5);
    width: 100%;
}

.btn-pass:hover:not(:disabled) {
    background: linear-gradient(135deg, #1c253a 0%, #273550 40%, #332f52 70%, #222540 100%);
    border-color: rgba(110, 150, 210, 0.55);
    box-shadow: inset 0 1px 0 rgba(140, 180, 240, 0.18), 0 2px 14px rgba(40, 60, 120, 0.35);
    color: #9ab8d8;
}

#tray-header-controls button#tray-btn-pass {
    margin-right: 1em;
}

@keyframes pass-alert {

    0%,
    100% {
        background: linear-gradient(135deg, #151c2e 0%, #1e2d48 40%, #2a2645 70%, #1a1e35 100%);
        color: #7a9cc4;
    }

    50% {
        background: #c0392b;
        color: #fff;
    }
}

.btn-pass--alert {
    animation: pass-alert 1.4s ease-in-out infinite;
    border-color: #c0392b;
}

.btn-special {
    background: linear-gradient(135deg, rgb(110, 120, 140), rgb(200, 215, 235));
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 10, 30, 0.7), 0 -1px 0 rgba(230, 245, 255, 0.3);
    border: 1px solid rgba(210, 230, 255, 0.35);
    box-shadow: rgba(170, 195, 235, 0.2) 0px 0px 8px;
    border-radius: 0.714em;
    padding: 0.571em 1em;
    font-size: .85em;
    transition: border-color .2s, box-shadow .2s;
}

.btn-special:hover:not(:disabled) {
    background: linear-gradient(135deg, rgb(70, 78, 95), rgb(140, 155, 180));
    border-color: rgba(210, 230, 255, 0.43);
    box-shadow: rgba(170, 195, 235, 0.15) 0px 0px 8px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 10, 30, 0.85), 0 -1px 0 rgba(230, 245, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOBBY
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes starfield {
    from {
        background-position: 0 0, 0 0, 0 0;
    }

    to {
        background-position: 200px 200px, 150px 400px, 350px 100px;
    }
}

@keyframes logo-glow {

    0%,
    100% {
        text-shadow:
            0 0 0.3em #ffe66d66,
            0 0 0.8em #ffe66d33,
            0 0.05em 0.15em rgba(0, 0, 0, .9);
    }

    50% {
        text-shadow:
            0 0 0.5em #ffe66daa,
            0 0 1.2em #ffe66d55,
            0 0 2em #c084fc33,
            0 0.05em 0.15em rgba(0, 0, 0, .9);
    }
}

#screen-lobby {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 10%, #3d1b7e 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, #1b3a6e 0%, transparent 45%),
        radial-gradient(ellipse at 60% 30%, #1a0a3a 0%, transparent 40%),
        var(--bg);
    position: relative;
    overflow: hidden;
}

/* Étoiles CSS pur — 3 couches de points de tailles différentes */
#screen-lobby::before,
#screen-lobby::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#screen-lobby::before {
    background-image:
        radial-gradient(1px 1px at 10% 15%, #ffffff55 0%, transparent 100%),
        radial-gradient(1px 1px at 25% 40%, #ffffff44 0%, transparent 100%),
        radial-gradient(1px 1px at 40% 8%, #ffffff66 0%, transparent 100%),
        radial-gradient(1px 1px at 55% 70%, #ffffff33 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 20%, #ffffff55 0%, transparent 100%),
        radial-gradient(1px 1px at 85% 55%, #ffffff44 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 15% 80%, #ffffff44 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 30% 60%, #ffe66d33 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 50% 35%, #ffffff33 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 65% 85%, #c084fc33 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 80% 10%, #ffffff44 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 92% 45%, #ffffff33 0%, transparent 100%),
        radial-gradient(2px 2px at 5% 50%, #ffe66d22 0%, transparent 100%),
        radial-gradient(2px 2px at 45% 90%, #ffffff33 0%, transparent 100%),
        radial-gradient(2px 2px at 75% 65%, #ffe66d22 0%, transparent 100%),
        radial-gradient(2px 2px at 90% 25%, #c084fc22 0%, transparent 100%);
    animation: starfield 80s linear infinite;
}

#screen-lobby::after {
    background-image:
        radial-gradient(1px 1px at 8% 30%, #ffffff33 0%, transparent 100%),
        radial-gradient(1px 1px at 20% 75%, #ffffff44 0%, transparent 100%),
        radial-gradient(1px 1px at 35% 20%, #ffffff22 0%, transparent 100%),
        radial-gradient(1px 1px at 48% 55%, #ffe66d22 0%, transparent 100%),
        radial-gradient(1px 1px at 60% 10%, #ffffff33 0%, transparent 100%),
        radial-gradient(1px 1px at 72% 40%, #ffffff44 0%, transparent 100%),
        radial-gradient(1px 1px at 88% 70%, #c084fc33 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 3% 65%, #ffffff22 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 42% 45%, #ffffff33 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 58% 80%, #ffe66d22 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 95% 15%, #ffffff33 0%, transparent 100%);
    animation: starfield 120s linear infinite reverse;
}

.lobby-card {
    background: rgba(12, 6, 28, 0.55);
    backdrop-filter: blur(20px) brightness(1.08);
    -webkit-backdrop-filter: blur(20px) brightness(1.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.3);
    border-radius: 1.2em;
    padding: 2.857em 2.571em;
    width: min(52em, 90vw);
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1em;
    box-shadow:
        0 0 0 0.071em #ffe66d22,
        0 4px 6px rgba(0, 0, 0, 0.4),
        0 1.429em 4.286em rgba(0, 0, 0, .7),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* reflet haut */
.lobby-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 100%);
    border-radius: 1.2em 1.2em 0 0;
    pointer-events: none;
    z-index: 0;
}

/* Liseré or intérieur */
.lobby-card::before {
    content: '';
    position: absolute;
    inset: 0.45em;
    border-radius: 0.85em;
    border: 0.071em solid #ffe66d18;
    pointer-events: none;
}

/* ── Lobby pitch ─────────────────────────────────────────────────────────── */
.lobby-tagline {
    text-align: center;
    font-size: 1.19em;
    color: rgba(255, 220, 100, 0.75);
    letter-spacing: 0.04em;
    margin: -0.25em 0 0.25em;
}

.lobby-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75em;
    margin: 0.25em 0;
}

.lobby-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35em;
}

.lobby-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4em;
    height: 2.4em;
    border-radius: 50%;
    background: rgba(255, 210, 80, 0.1);
    border: 1px solid rgba(255, 210, 80, 0.25);
    color: #ffd25a;
}

.lobby-step-icon svg {
    width: 1.38em;
    height: 1.38em;
}

.lobby-step-label {
    font-size: 0.875em;
    color: rgba(255, 255, 255, 0.72);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lobby-step-arrow {
    color: rgba(255, 210, 80, 0.35);
    margin-bottom: 1.2em;
    display: flex;
    align-items: center;
}

.lobby-step-arrow svg {
    width: 1.38em;
    height: 1.38em;
}

.btn-arrow {
    display: inline-flex;
    align-items: center;
    margin-left: 0.4em;
    vertical-align: middle;
}

.btn-arrow svg {
    width: 0.85em;
    height: 0.85em;
}

.lobby-goal {
    text-align: center;
    font-size: 1.03em;
    color: rgb(255, 255, 255);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75em;
    flex-wrap: wrap;
    margin: -0.25em 0 0.25em;
}

.lobby-social-proof {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.6);
    margin: -0.1em 0 0.4em;
}

.lobby-social-sep {
    opacity: 0.4;
}

.lobby-rules-link {
    background: none;
    border: none;
    color: rgb(255, 211, 80);
    font-size: 1em;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-decoration-color: rgba(255, 210, 80, 0.25);
    transition: color 0.2s;
}

.lobby-rules-link:hover {
    color: #ffd25a;
    text-decoration-color: rgba(255, 210, 80, 0.6);
}

.lobby-rules-link:active {
    opacity: 0.7;
}

@keyframes logo-ornament {

    0%,
    100% {
        opacity: 0.6;
        transform: scaleX(1);
    }

    50% {
        opacity: 1;
        transform: scaleX(1.05);
    }
}

.logo {
    font-family: "Macondo Swash Caps", sans-serif;
    font-size: 4em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25em;
    animation: logo-glow 4s ease-in-out infinite;
    position: relative;
}

.logo::before,
.logo::after {
    content: '✦';
    font-size: 1em;
    color: #ffe66d99;
    vertical-align: middle;
    margin: 0 0.5em;
    animation: logo-ornament 4s ease-in-out infinite;
    display: inline-block;
}

.logo span {
    color: var(--accent2);
}

/* ─── Options lobby ───────────────────────────────────────────────────────── */
.options-section[hidden] {
    display: none;
}

.options-section {
    border-color: #ffe66d22 !important;
    display: flex;
    flex-direction: column;
    padding: 0 1em;
    font-size: 1.25em;
}

.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    padding: 0.65em 0;
    cursor: pointer;
    user-select: none;
}

.option-row+.option-row {
    border-top: 1px dotted #ffe66d22;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    font-size: 0.88em;
    line-height: 1.4;
    flex: 1;
}

.option-icon {
    flex-shrink: 0;
    margin-top: 0.05em;
    opacity: 0.75;
    display: flex;
    align-items: center;
}

.option-icon svg {
    width: 1em;
    height: 1em;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 2.5em;
    height: 1.35em;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-knob {
    position: absolute;
    inset: 0;
    background: #150f2a;
    border: 1px solid #3a3060;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.toggle-knob::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0.18em;
    transform: translateY(-50%);
    width: 0.88em;
    height: 0.88em;
    background: #3a3060;
    border-radius: 50%;
    transition: transform 0.22s ease, background 0.2s;
}

.toggle-switch input:checked+.toggle-knob {
    background: #ffe66d1a;
    border-color: #ffe66d99;
    box-shadow: 0 0 0.5em #ffe66d33;
}

.toggle-switch input:checked+.toggle-knob::after {
    transform: translateY(-50%) translateX(1.15em);
    background: #ffe66d;
    box-shadow: 0 0 0.3em #ffe66d88;
}

/* Timer options */
.timer-options {
    display: none;
    flex-direction: column;
    gap: 0.45em;
    border-top: 1px dotted #ffe66d22;
    font-size: 0.85em;
    color: var(--muted);
    padding: 0 3em;
}

.duration-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
}

.dur-btn {
    background: #150f2a;
    border: 1px solid #3a3060;
    border-radius: 9999px;
    color: var(--muted);
    padding: 0.2em 0.75em;
    font-family: inherit;
    font-size: 1.25em;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.dur-btn:hover {
    background: #ffe66d11;
    border-color: #ffe66d55;
    color: #ffe66dcc;
}

.dur-btn.selected {
    background: #ffe66d18;
    border-color: #ffe66daa;
    color: #ffe66d;
    box-shadow: 0 0 0.4em #ffe66d33;
}

.lobby-section {
    background: #0d0b18;
    border: 0.071em solid #3a3060;
    border-radius: 0.714em;
    padding: 0.714em 1em;
    box-shadow: inset 0 0.1em 0.5em rgba(0, 0, 0, .4);
}

.lobby-section.gems {
    max-width: 40em;
    margin: auto;
}

#gem-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.357em;
    justify-content: center;
    max-height: 12em;
    overflow-y: auto;
    padding: 0.5em;
}

.gem-pick {
    background: transparent;
    border: 0.143em solid transparent;
    border-radius: 0.5em;
    padding: 0.214em;
    cursor: pointer;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}

.gem-pick:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0.5em #ffe66d55;
}

.gem-pick.active {
    border-color: var(--accent2);
    transform: scale(1.2);
    box-shadow: 0 0 0.6em #ffe66d88;
}

.home_divider {
    display: flex;
    align-items: center;
    gap: 0.714em;
    color: #ffe66daa;
    letter-spacing: 0.2em;
}

.home_divider::before,
.home_divider::after {
    content: '';
    flex: 1;
    height: 0.1em;
    background: linear-gradient(to right, transparent, #ffe66d66, transparent);
}

.join-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.571em;
}

.join-row input {
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.143em;
    border-color: #ffe66d44;
    font-family: var(--font-system);
}

.join-row input:focus {
    border-color: #ffe66daa;
    box-shadow: inset 0 0.1em 0.4em rgba(0, 0, 0, .5), 0 0 0.6em #ffe66d44;
}

.join-row .btn {
    white-space: nowrap;
    flex-grow: 1;
    background: #1a1408;
    color: #ffe66d;
    border: 0.071em solid #ffe66d55;
    box-shadow: 0 0 0.4em #ffe66d22, inset 0 0.071em 0 #ffe66d22;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.join-row .btn:hover:not(:disabled) {
    border-color: #ffe66daa;
    box-shadow: 0 0 0.8em #ffe66d55, inset 0 0.071em 0 #ffe66d44;
    transform: translateY(-0.143em);
}

.home_section {
    font-size: 1.1em;
    font-variant: small-caps;
    letter-spacing: 0.12em;
    color: #ffe66dcc;
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding-bottom: 0.3em;
}

.options-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    padding: 0;
    padding-bottom: 0.3em;
    align-items: center;
}

.options-toggle::after {
    display: none;
}

.options-chevron {
    width: 0.7em;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #ffe66d66;
    margin-left: 0.5em;
}

.options-toggle[aria-expanded="true"] .options-chevron {
    transform: rotate(90deg);
}

.home_section::before,
.home_section::after {
    content: '⬥';
    font-size: 0.6em;
    color: #ffe66d66;
    flex-shrink: 0;
}

#btn-create {
    background: none;
    border: none;
    aspect-ratio: 1 / 1;
    color: #e8a020;
    text-shadow: 0 0 0.4em #c67c2a88;
    cursor: pointer;
    transition: color .15s, text-shadow .15s, transform .15s;
    padding: 0.2em;
    width: 3em;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-create span {
    font-size: 4.5em;
}

#btn-create:hover {
    color: #ffe66d;
    text-shadow: 0 0 0.8em #ffe66daa;
    transform: scale(1.2);
}

#btn-create:active {
    transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SALLE D'ATTENTE
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-waiting {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: radial-gradient(ellipse at 70% 80%, #1b3a6e 0%, var(--bg) 60%);
}

.waiting-card {
    background: rgba(12, 6, 28, 0.55);
    backdrop-filter: blur(20px) brightness(1.08);
    -webkit-backdrop-filter: blur(20px) brightness(1.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 6px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5),
        inset 0 1px 0 rgba(255, 255, 255, .15), inset 0 -1px 0 rgba(255, 255, 255, .04);
    border-radius: 1.429em;
    padding: 2.571em;
    width: min(28.571em, 95vw);
    display: flex;
    flex-direction: column;
    gap: 1.286em;
    position: relative;
    overflow: hidden;
}

.waiting-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 100%);
    border-radius: 1.429em 1.429em 0 0;
    pointer-events: none;
}

.waiting-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40%;
    height: 40%;
    background: radial-gradient(ellipse at 100% 100%, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.waiting-card h2 {
    font-family: 'Macondo Swash Caps', sans-serif;
    font-size: 2em;
    font-weight: 700;
    text-align: center;
    animation: logo-glow 4s ease-in-out infinite;
}

.room-code-display {
    font-size: 1.6em;
    padding: 0.514em 0.643em;
    display: flex;
    align-items: center;
    gap: 0.714em;
    justify-content: space-between;
}

.room-code-display span {
    color: var(--accent2);
    letter-spacing: 0.286em;
    font-family: var(--font-system);
}

.btn-copy {
    background: none;
    color: var(--muted);
    font-size: 1.2em;
    padding: 0;
    line-height: 1;
}

.btn-copy svg {
    width: 1em;
    height: 1em;
    display: block;
}

.btn-copy:hover {
    color: var(--text);
}

#player-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.571em;
}

#player-list li {
    background: linear-gradient(135deg, #0a0f1c 0%, #162540 30%, #2a2250 60%, #0e1128 100%);
    border: 1px solid rgba(100, 140, 210, 0.25);
    border-radius: 0.3em;
    padding: 0.571em 1em;
    display: flex;
    align-items: center;
    gap: 0.714em;
    font-weight: 600;
    color: #fff;
}


/* ═══════════════════════════════════════════════════════════════════════════
   ÉCRAN DE JEU
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-game {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.game-header {
    background: var(--bg2);
    border-bottom: 0.071em solid var(--border);
    padding: 0.714em;
    height: var(--header-h);
    display: flex;
    align-items: center;
}

#tray-header-base {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.thb {
    display: flex;
    align-items: center;
}

.thb.right {
    gap: 1em;
}

#btn-peek {
    padding: 0.714em 1.571em;
    border-radius: 0.857em;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #c67c2a 0%, #e8a020 50%, #c67c2a 100%);
    background-size: 200% 100%;
    color: #1a0f00;
    border: 0.071em solid #ffe66d55;
    box-shadow: 0 0.2em 0.8em #c67c2a55, inset 0 0.071em 0 #ffe66d66;
    transition: transform .15s, box-shadow .15s, background-position .3s;
}

#btn-peek:hover {
    background-position: 100% 0;
    box-shadow: 0 0.3em 1.2em #c67c2a88, inset 0 0.071em 0 #ffe66d88;
    transform: translateY(-0.143em);
}

#btn-peek:active {
    transform: translateY(0);
}

#btn-peek svg {
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    pointer-events: none;
}

#tray-header-controls {
    display: none;
}

#tray-header-controls button {
    width: max-content;
    text-wrap: nowrap;
    margin: 0;
}

.thc_container {
    display: flex;
    justify-content: center;
    width: 33.3333%;
}

.thc_container:first-child {
    justify-content: start;
}

.thc_container:last-child {
    justify-content: end;
}

.game-header.tray-open>*:not(#tray-header-controls) {
    display: none;
}

.game-header.tray-open #tray-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.game-title {
    font-size: 1.7em;
    white-space: nowrap;
    margin: 0;
}

.game-title.logo::before {
    margin-left: 0;
}

#players-bar {
    display: flex;
    gap: 0.714em;
    flex-wrap: wrap;
    flex: 1;
}

.player-chip {
    display: flex;
    align-items: center;
    gap: 0.429em;
    background: var(--bg3);
    border-radius: 1.429em;
    padding: 0.286em 0.857em 0.286em 0.429em;
    font-size: .85em;
    font-weight: 700;
    border: 0.143em solid transparent;
    transition: border-color .3s;
}

.player-chip.active-player {
    background: linear-gradient(135deg, #fd9644, #fe6b00);
    border-color: transparent;
    color: var(--surface);
}


.player-chip .tokens-badge {
    border-radius: 0.714em;
    padding: 0.071em 0.429em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.2em;
}

.player-chip .player-name {
    font-size: 1.2em;
}

.player-chip .tokens-icon {
    font-size: 1.5em;
    line-height: 1;
}

.player-chip .tokens-count {
    font-size: 1.2em;
}

.player-chip.active-player .tokens-badge {
    color: #000;
}

#game-layout {
    display: flex;
    gap: 1.143em;
    padding: 1.143em;
    min-height: 0;
    position: absolute;
    background: radial-gradient(ellipse 130% 100% at 50% 100%, #1a0a35 0%, #07030f 65%);
    overflow: auto;
    left: 0;
    right: 0;
    top: var(--header-h);
    bottom: 0;
}

#game-layout::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 65% 55% at 50% 58%, rgba(120, 60, 240, 0.28) 0%, transparent 70%);
    animation: tray-glow-pulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* ─── Plateau ─────────────────────────────────────────────────────────────── */
#board {
    display: grid;
    grid-template-columns: repeat(var(--board-cols, 7), 1fr);
    grid-template-rows: repeat(var(--board-rows, 7), 1fr);
    flex: none;
    align-self: flex-start;
    width: min(calc(100vw - var(--sidebar-w) - var(--layout-gap) - var(--layout-pad) * 2),
            calc(100vh - var(--header-h) - var(--layout-pad) * 2));
    aspect-ratio: 1;
    container-type: size;
    margin: 0 auto;
}

.cell {
    width: 100%;
    border-radius: 0.714em;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: default;
    user-select: none;
    transition: transform .15s, box-shadow .15s;
    background-image: url('/assets/ui/tiles.png');
    background-size: 400% 300%;
    font-size: calc(100cqw / 7 * var(--cell-font-scale));
}

/* ─── Animations pose & capture de pion ─────────────────────────────────── */
@keyframes token-pop {
    0% {
        transform: scale(0) rotate(-15deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.3) rotate(4deg);
        opacity: 1;
    }

    80% {
        transform: scale(0.92) rotate(-2deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes cell-flash {
    0% {
        box-shadow: inset 0 0 0 2px rgba(255, 210, 80, 0), 0 0 0px rgba(255, 210, 80, 0);
    }

    25% {
        box-shadow: inset 0 0 0 2px rgba(255, 210, 80, 0.9), 0 0 18px rgba(255, 210, 80, 0.55);
    }

    100% {
        box-shadow: inset 0 0 0 2px rgba(255, 210, 80, 0), 0 0 0px rgba(255, 210, 80, 0);
    }
}

.token--new {
    animation: token-pop 0.35s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

.cell--flash {
    animation: cell-flash 0.7s ease-out forwards;
}

@keyframes token-capture {
    0% {
        transform: scale(0) rotate(20deg);
        opacity: 0;
        filter: brightness(3) saturate(3);
    }

    40% {
        transform: scale(1.45) rotate(-6deg);
        opacity: 1;
        filter: brightness(2) saturate(2);
    }

    70% {
        transform: scale(0.88) rotate(3deg);
        filter: brightness(1.2) saturate(1.5);
    }

    100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1) saturate(1);
    }
}

@keyframes cell-capture-fire {
    0% {
        box-shadow: inset 0 0 0 2px rgba(255, 80, 0, 0), 0 0 0px rgba(255, 80, 0, 0), 0 0 0px rgba(255, 200, 0, 0);
    }

    15% {
        box-shadow: inset 0 0 0 3px rgba(255, 120, 0, 1), 0 0 24px rgba(255, 60, 0, 0.8), 0 0 48px rgba(255, 180, 0, 0.4);
    }

    45% {
        box-shadow: inset 0 0 0 2px rgba(255, 160, 0, 0.7), 0 0 16px rgba(255, 80, 0, 0.5), 0 0 32px rgba(255, 140, 0, 0.2);
    }

    100% {
        box-shadow: inset 0 0 0 2px rgba(255, 80, 0, 0), 0 0 0px rgba(255, 80, 0, 0), 0 0 0px rgba(255, 200, 0, 0);
    }
}

@keyframes fire-tongue {
    0% {
        transform: scaleY(0) translateY(0);
        opacity: 0.9;
    }

    40% {
        transform: scaleY(1.2) translateY(-60%);
        opacity: 0.7;
    }

    100% {
        transform: scaleY(0.3) translateY(-120%);
        opacity: 0;
    }
}

.token--capture {
    animation: token-capture 0.45s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

.cell--capture {
    animation: cell-capture-fire 0.9s ease-out forwards;
    overflow: visible;
    z-index: 2;
}

.cell--capture::after {
    content: '';
    position: absolute;
    inset: 10% 20%;
    bottom: auto;
    height: 80%;
    background: linear-gradient(to top,
            rgba(255, 60, 0, 0.85) 0%,
            rgba(255, 140, 0, 0.6) 40%,
            rgba(255, 220, 0, 0.3) 70%,
            transparent 100%);
    border-radius: 50% 50% 20% 20%;
    filter: blur(4px);
    pointer-events: none;
    animation: fire-tongue 0.7s ease-out forwards;
    z-index: 3;
}

/* ─── Tuiles sprite par type ──────────────────────────────────────────────── */
.cell[data-type="NUMBERED"] {
    background-position: 0% 0%;
}

.cell[data-type="SMALL"] {
    background-position: 33.333% 0%;
}

.cell[data-type="BIG"] {
    background-position: 66.667% 0%;
}

.cell[data-type="FULL"] {
    background-position: 100% 0%;
}

.cell[data-type="PETITE_QUINTE"] {
    background-position: 0% 50%;
}

.cell[data-type="APPEL"] {
    background-position: 33.333% 50%;
}

.cell[data-type="PARITE"] {
    background-position: 66.667% 50%;
}

.cell[data-type="SEC"] {
    background-position: 100% 50%;
}

.cell[data-type="CHANCE"] {
    background-position: 0% 100%;
}

.cell[data-type="GRANDE_QUINTE"],
.cell[data-type="QUINTE"] {
    background-position: 33.333% 100%;
}

.cell[data-type="CARRE"] {
    background-position: 66.667% 100%;
}

.cell[data-type="YAM"] {
    background-position: 100% 100%;
}

/* ─── Couleur du texte pour les cases claires ────────────────────────────── */
.cell[data-type="CARRE"],
.cell[data-type="SEC"] {
    color: #222;
}

/* ─── Tailles de labels par type ─────────────────────────────────────────── */
.cell[data-type="NUMBERED"] .cell-label {
    font-size: var(--fs-numbered);
    color: #000000b2;
}

.cell[data-type="FULL"] .cell-label {
    font-size: var(--fs-full);
    color: #000000b2;
}

.cell[data-type="BIG"] .cell-label {
    font-size: var(--fs-big);
}

.cell[data-type="SMALL"] .cell-label {
    font-size: var(--fs-small);
}

.cell[data-type="PETITE_QUINTE"] .cell-label {
    font-size: var(--fs-petite-quinte);
}

.cell[data-type="GRANDE_QUINTE"] .cell-label {
    font-size: var(--fs-grande-quinte);
}

.cell[data-type="CHANCE"] .cell-label {
    font-size: var(--fs-chance);
}

.cell[data-type="CARRE"] .cell-label {
    font-size: var(--fs-carre);
    color: #fff;
}

.cell[data-type="PARITE"] .cell-label {
    font-size: var(--fs-parite);
}

.cell[data-type="APPEL"] .cell-label {
    font-size: var(--fs-appel);
}

.cell[data-type="SEC"] .cell-label {
    font-size: var(--fs-sec);
}

.cell[data-type="YAM"] .cell-label {
    font-size: var(--fs-yam);
}

.cell-label {
    font-family: "Macondo Swash Caps", sans-serif;
    font-weight: 400;
    font-size: 1.286em;
    text-align: center;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.036em;
    text-shadow: 0 0.071em 0.143em rgba(0, 0, 0, .5);
    pointer-events: none;
    z-index: 1;
}

.cell[data-type="SEC"] .cell-label {
    color: #fff;
}

.cell:hover .cell-label {
    z-index: 5;
}

/* ─── Token posé ─────────────────────────────────────────────────────────── */
.token {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.571em;
    animation: pop .25s cubic-bezier(.34, 1.56, .64, 1);
    overflow: visible;
    z-index: 2;
    font-size: 2.7cqw;
}

.token::after {
    content: attr(data-player);
    position: absolute;
    bottom: calc(85%);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .85);
    color: #fff;
    font-family: 'IM Fell English', serif;
    font-size: 0.7em;
    font-weight: 700;
    white-space: nowrap;
    padding: 0.25em 0.6em;
    border-radius: 0.4em;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
}

.token:hover::after {
    opacity: 1;
}


.token .gem {
    filter: drop-shadow(0 0 .5em rgba(0, 0, 0, 0.83))
}

@keyframes pop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: .88;
    }
}

/* Tentative de pose invalide */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-0.357em);
    }

    40% {
        transform: translateX(0.357em);
    }

    60% {
        transform: translateX(-0.286em);
    }

    80% {
        transform: translateX(0.286em);
    }
}

.cell.invalid {
    animation: shake .35s ease;
}


/* Alignement mis en valeur */
.cell.aligned::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.571em;
    background: rgba(255, 215, 0, .35);
    pointer-events: none;
}

/* ─── Particules fond (game-layout + lobby) ─────────────────────────────── */
.bg-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* ─── Verre cristal (glass panels) ──────────────────────────────────────── */
#turn-banner,
#dice-section,
#dice-score,
#combo-display,
.special-panel,
#scores-panel,
#log-panel,
#debug-panel,
#help-panel,
#about-panel,
#combo-detail-panel {
    background: rgba(12, 6, 28, 0.55);
    backdrop-filter: blur(20px) brightness(1.08);
    -webkit-backdrop-filter: blur(20px) brightness(1.08);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-top-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.4),
        0 16px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
}

#turn-banner::before,
#dice-section::before,
#dice-score::before,
#combo-display::before,
.special-panel::before,
#scores-panel::before,
#log-panel::before,
#debug-panel::before,
#help-panel::before,
#about-panel::before,
#combo-detail-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

#turn-banner::after,
#dice-section::after,
#dice-score::after,
#combo-display::after,
.special-panel::after,
#scores-panel::after,
#log-panel::after,
#debug-panel::after,
#help-panel::after,
#about-panel::after,
#combo-detail-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40%;
    height: 30%;
    background: radial-gradient(ellipse at 100% 100%, rgba(255, 255, 255, 0.04), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.857em;
    width: var(--sidebar-w);
    flex-shrink: 0;
}

#turn-banner {
    display: flex;
    gap: 1em;
    align-items: center;
    border-radius: 0.3em;
    padding: 0.857em 1.143em;
    font-weight: 700;
    font-size: 1em;
    text-align: center;
    line-height: 1.3em;
}

#turn-banner .turn-txt {
    width: 100%;
}

#turn-banner .gem.gem-sm {
    font-size: 0.8em;
    margin: 0 1em;
    flex-shrink: 0;
}

#chance-banner {
    display: none;
    border-radius: 0.3em;
    padding: 0.6em 1em;
    background: linear-gradient(135deg, #b8860b, #ffd700, #b8860b);
    color: #1a1000;
    font-weight: 700;
    font-size: 1em;
    text-align: center;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

#chance-banner.visible {
    display: block;
}

#dice-section {
    border-radius: 0.3em;
    padding: 1em;
    display: flex;
    flex-direction: column;
    gap: 1em;
    flex-shrink: 0;
}

#dice-row {
    display: flex;
    gap: 1em;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─── Dés — SVG faces ─────────────────────────────────────────────────────── */
.die {
    --die-color: #ffe066;
    width: 4.571em;
    height: 4.571em;
    border-radius: 0.714em;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: var(--die-color);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    user-select: none;
    flex-shrink: 0;
}

.die img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    filter: invert(1);
    pointer-events: none;
}

.die.kept {
    border: 2px solid #ffd25a;
    background: var(--die-color);
    box-shadow:
        0 0 3px #fffbe0,
        0 0 8px #ffd700,
        0 0 18px #e8a020,
        0 0 32px rgba(232, 160, 32, 0.45);
    transform: scale(1.08);
}

.die.inactive {
    cursor: default;
    opacity: 0.55;
}

.die:not(.inactive):not(.kept):hover {
    border-color: color-mix(in srgb, var(--die-color) 60%, transparent);
    transform: translateY(-2px);
}

#dice-hint {
    text-align: center;
    font-size: .78em;
    color: var(--muted);
    margin-bottom: 0.571em;
    min-height: 1em;
}

#dice-actions {
    display: flex;
    flex-direction: column;
    gap: 0.429em;
}

/* ─── Tapis de dés (overlay pleine zone jouable) ─────────────────────────── */
#dice-tray {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: radial-gradient(ellipse 130% 100% at 50% 100%, #1a0a35 0%, #07030f 65%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2em;
    padding: 2em;
    transform: translateY(100%);
    opacity: 0;
    transition: transform .35s cubic-bezier(.4, 0, .2, 1), opacity .35s ease;
    overflow: hidden;
}

/* lueur ambrée animée */
#dice-tray::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 65% 55% at 50% 58%, rgba(120, 60, 240, 0.28) 0%, transparent 70%);
    animation: tray-glow-pulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes tray-glow-pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* particules dorées (ambiantes + burst au roll) */
.tray-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 0%, #ffe566 25%, #ffaa00 60%, #ff6600 100%);
    box-shadow:
        0 0 calc(var(--p-size) * 1.5) calc(var(--p-size) * 0.6) rgba(255, 210, 60, 0.65),
        0 0 calc(var(--p-size) * 3) calc(var(--p-size) * 0.2) rgba(255, 160, 0, 0.3);
    pointer-events: none;
    z-index: 1;
    bottom: 0;
    left: var(--p-x);
    width: var(--p-size);
    height: var(--p-size);
    animation: tray-particle-rise var(--p-dur) ease-out forwards;
}

@keyframes tray-particle-rise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: var(--p-opacity, 0.85);
    }

    60% {
        opacity: calc(var(--p-opacity, 0.85) * 0.6);
    }

    100% {
        transform: translateY(var(--p-rise)) translateX(var(--p-drift)) scale(0.05);
        opacity: 0;
    }
}

#dice-tray.open {
    transform: translateY(0);
    opacity: 1;
}

#dice-tray.peek {
    opacity: 0.7;
    pointer-events: none;
}

#dice-3d-container {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#dice-3d-container canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

#tray-dice-row {
    display: flex;
    position: absolute;
    bottom: 5em;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    transition: opacity .2s;
    gap: 1.5em;
    justify-content: center;
    flex-wrap: wrap;
}

#tray-dice-row .die {
    width: 4em;
    height: 4em;
    border-radius: .6em;
    font-size: 1.5em;
}

#dice-tray.rolling #tray-dice-row {
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.2s;
}

#tray-dice-hint {
    text-align: center;
    font-size: .85em;
    color: var(--muted);
    min-height: 1em;
}

#tray-dice-actions {
    display: flex;
    gap: 0.8em;
    justify-content: center;
}

#tray-dice-actions .btn {
    min-width: 10em;
}

#dice-score,
#combo-display {
    border-radius: 0.3em;
    padding: 0.857em 1em;
    border: 0.071em solid var(--border);
    font-size: 1.35em;
    text-align: center;
    min-height: 3.143em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.429em;
}

#tray-dice-score {
    display: flex;
    position: absolute;
    bottom: 6.5em;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    transition: opacity .2s;
    gap: 1.5em;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 2em;
}

.combo-tag {
    background: #25234469;
    border-radius: 0.5em;
    padding: 0.214em 0.714em;
    font-weight: 700;
    font-size: .8em;
    border: 0.1em solid #60606069;
}

#special-actions {
    display: flex;
    flex-direction: column;
    gap: 0.571em;
}

.special-panel {
    border-radius: 0.3em;
    padding: 0.857em 1em;
    border: 0.071em solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.571em;
}

.special-panel label {
    font-size: .85em;
    color: var(--muted);
}

.special-panel .row {
    display: flex;
    gap: 0.571em;
    align-items: center;
}

.special-panel select {
    flex: 1;
    background: var(--bg3);
    color: var(--text);
    border: 0.143em solid var(--border);
    border-radius: 0.571em;
    padding: 0.429em 0.714em;
    font-family: 'IM Fell English', serif;
    font-size: .85em;
    text-transform: uppercase;
}

#scores-panel,
#log-panel {
    border-radius: 0.3em;
    padding: 0.857em 1em;
}

#scores-panel h3,
#log-panel h3 {
    font-size: .95em;
    margin-bottom: 0.571em;
    color: var(--accent2);
}

#scores-list {
    display: flex;
    flex-direction: column;
    gap: 0.429em;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 0.571em;
    border-radius: 0.3em;
    padding: 0em 0.4em;
    height: 2em;
    justify-content: space-between;
}

.score-col {
    display: flex;
    align-items: center;
    gap: 0.571em;
}

.score-col img {
    width: 1.5em;
    height: 1.5em;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 0.571em;
    border-radius: 0.3em;
    padding: 0em 0.4em;
    height: 2em;
    justify-content: space-between;
    color: #fff;
    overflow: hidden;
}

.score-row.active {
    color: #181100c9;
    background: linear-gradient(135deg, rgb(160, 120, 32), rgb(245, 200, 66));
    border: 1px solid rgba(255, 224, 102, 0.43);
    box-shadow: rgba(245, 185, 40, 0.25) 0px 0px 10px, rgb(255, 220, 80) 0px 0px 3px;
}

.score-row .tokens-badge {
    display: flex;
    align-items: center;
    gap: 0.2em;
    flex-shrink: 0;
}

.score-row .score-name {
    font-weight: bold;
}

.tokens-count {
    font-size: 1.5em;
    margin-top: -0.25em;
    margin-left: 0.05em;
}

.tokens-icon svg {
    width: 1.25em;
    height: 1.25em;
    display: block;
}

.score-row .pts {
    font-weight: 700;
    flex-shrink: 0;
    height: 2em;
    background: #3d250678;
    margin-right: -0.5em;
    display: flex;
    align-items: center;
    padding: 0.5em;
    color: #fff;
    box-shadow: 0.2em 0 0.15em rgba(0, 0, 0, 0.25) inset;
}

#log-list {
    display: flex;
    flex-direction: column;
    gap: 0.286em;
    max-height: 10.714em;
    overflow-y: auto;
}

.log-entry {
    font-size: .75em;
    color: var(--muted);
    line-height: 1.4;
    padding: 0.143em 0;
    border-bottom: 0.071em solid rgba(255, 255, 255, .05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIN DE PARTIE
   ═══════════════════════════════════════════════════════════════════════════ */
/* ─── Rejoin overlay ─────────────────────────────────────────────────────── */
#rejoin-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 1, 14, 0.85);
    backdrop-filter: blur(12px);
}

#rejoin-overlay.afk-hidden {
    display: none;
}

#rejoin-card {
    background: rgba(12, 6, 28, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 40px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .1);
    border-radius: 1.2em;
    padding: 2.5em 3em;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
    min-width: 18em;
    animation: rejoin-pop .35s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes rejoin-pop {
    from {
        transform: scale(.85);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#rejoin-icon {
    color: #ffd25a;
    width: 2.8em;
    height: 2.8em;
    background: rgba(255, 210, 80, 0.1);
    border: 1px solid rgba(255, 210, 80, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#rejoin-icon svg {
    width: 1.4em;
    height: 1.4em;
}

#rejoin-title {
    color: #e8e8f8;
    font-size: 1.1em;
    font-weight: 600;
    margin: 0;
}

#rejoin-subtitle {
    color: var(--muted);
    font-size: .85em;
    margin: 0;
}

/* ─── AFK Warning ────────────────────────────────────────────────────────── */
#afk-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    transition: opacity .3s;
}

#afk-overlay.afk-hidden {
    display: none;
}

#afk-card {
    background: rgba(12, 6, 28, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 40px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .1);
    border-radius: 1em;
    padding: 2em 2.5em;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
    min-width: 16em;
}

#afk-message {
    color: #c8c8d8;
    font-size: .95em;
}

#afk-countdown {
    font-size: 3.5em;
    font-weight: 700;
    color: #ffe066;
    text-shadow: 0 0 16px rgba(245, 185, 40, 0.7), 0 0 4px #fff;
    line-height: 1;
    transition: color .3s, text-shadow .3s;
}

#afk-countdown.urgent {
    color: #ff6b6b;
    text-shadow: 0 0 16px rgba(255, 80, 80, 0.7), 0 0 4px #fff;
    animation: afk-pulse .5s ease-in-out infinite alternate;
}

@keyframes afk-pulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

#btn-afk-reset {
    width: 100%;
}

/* ─── À ton tour overlay ──────────────────────────────────────────────────── */
#my-turn-overlay {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    animation: my-turn-fadein .25s ease;
}

#my-turn-overlay.afk-hidden {
    display: none;
}

@keyframes my-turn-fadein {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#my-turn-card {
    position: relative;
    overflow: hidden;
    background: rgba(12, 6, 28, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 220, 80, 0.5);
    box-shadow: 0 8px 40px rgba(0, 0, 0, .7),
        0 0 60px rgba(200, 150, 20, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, .12);
    border-radius: 1em;
    padding: 2em 2.5em;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
    min-width: 16em;
    animation: my-turn-pop .3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes my-turn-pop {
    from {
        transform: scale(.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#my-turn-icon {
    line-height: 1;
    animation: my-turn-bounce 1.2s ease-in-out infinite;
}

#my-turn-icon img {
    width: 64px;
    height: 64px;
    filter:
        drop-shadow(0 0 6px rgba(245, 185, 40, 1)) drop-shadow(0 0 18px rgba(245, 185, 40, 0.7)) drop-shadow(0 0 36px rgba(245, 185, 40, 0.35));
}

@keyframes my-turn-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

#my-turn-title {
    font-size: 1.3em;
    font-weight: 700;
    color: #ffe066;
    text-shadow: 0 0 16px rgba(245, 185, 40, 0.6);
    margin: 0;
}

.my-turn-buttons {
    display: flex;
    gap: .75em;
    width: 100%;
}

#screen-gameover {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 40%, #3d1a6e 0%, var(--bg) 60%);
}

@keyframes gameover-card-in {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.gameover-card {
    position: relative;
    background: rgba(12, 6, 28, 0.55);
    backdrop-filter: blur(20px) brightness(1.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.3);
    border-radius: 0.3em;
    padding: 2.857em 2.571em;
    display: flex;
    flex-direction: column;
    gap: 1.286em;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5),
        inset 0 1px 0 rgba(255, 255, 255, .15), inset 0 -1px 0 rgba(255, 255, 255, .04);
    text-align: center;
    overflow: hidden;
    animation: gameover-card-in 0.65s cubic-bezier(.34, 1.56, .64, 1) both;
}

.gameover-card::before {
    content: '';
    position: absolute;
    inset: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, .06), transparent);
    pointer-events: none;
}

.gameover-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60%;
    height: 40%;
    background: radial-gradient(ellipse at 100% 100%, rgba(255, 255, 255, .04), transparent 70%);
    pointer-events: none;
}

#winner-title {
    font-family: 'Macondo Swash Caps', serif;
    font-size: 1.9em;
    font-weight: 400;
    color: #ffe066;
    text-shadow: 0 0 18px rgba(245, 185, 40, .7), 0 0 4px rgba(255, 255, 255, .3);
    animation: logo-glow 3s ease-in-out infinite alternate;
    text-align: center;
}

#final-scores {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.final-score-row {
    background: linear-gradient(135deg, #0a0f1c 0%, #162540 30%, #2a2250 60%, #0e1128 100%);
    border: 1px solid rgba(100, 140, 210, 0.2);
    border-radius: 0.3em;
    padding: 0.55em 0.9em;
    display: flex;
    align-items: center;
    gap: 0.7em;
    font-weight: 600;
    color: #7a9cc4;
}

.final-score-row.winner {
    background: linear-gradient(135deg, rgb(160, 120, 32), rgb(245, 200, 66));
    border-color: rgba(255, 220, 80, 0.5);
    color: #1a0e00;
}

.final-score-row .pts {
    margin-left: auto;
    font-size: 1.1em;
    color: #ffe066;
    font-weight: 700;
}

.final-score-row.winner .pts {
    color: #1a0e00;
}

/* ─── Toast ─────────────────────────────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 1.714em;
    left: 50%;
    transform: translateX(-50%) translateY(5.714em);
    background: #333;
    color: #fff;
    border-radius: 0.857em;
    padding: 0.714em 1.429em;
    font-size: .9em;
    z-index: 1000;
    transition: transform .3s ease;
    pointer-events: none;
    white-space: nowrap;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ─── Lang picker header ─────────────────────────────────────────────────── */

#lang-picker-game {
    font-family: "Twemoji Country Flags", 'IM Fell English', serif;
    background: none;
    border: none;
    border-radius: 0.5em;
    color: var(--text);
    padding: 0.25em 0.35em 0;
    font-size: 1.25em;
    height: 2em;
    width: 2em;
    outline: none;
    cursor: pointer;
    appearance: none;
    text-align: center;
    transition: border-color .2s, background .2s;
}

#lang-picker-game:hover {
    border-color: #ffe066;
}

#lang-picker-game:focus {
    border-color: #ffe66d88;
    box-shadow: 0 0 0.5em #ffe66d33;
}

#lang-picker-game option {
    background: #1a1830;
    font-size: 0.85em;
}

/* ─── Aide ───────────────────────────────────────────────────────────────── */

#btn-help {
    width: 2.5em;
    height: 2.5em;
    border-radius: 50%;
    background: var(--accent2);
    color: #fff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
    color: #4a340a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 400ms;
}

#btn-help svg {
    width: 60%;
}

#btn-help:hover {
    background: linear-gradient(135deg, #a07820, #f5c842);
    color: #ffffff;
    border-color: #ffe066;
}

#btn-help:active {
    transform: scale(0.92);
}

#btn-quit {
    padding: 0.3em 0.75em;
    border-radius: 0.4em;
    background: transparent;
    color: var(--muted);
    font-size: 0.82em;
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.btnq_ico {
    display: flex;
    align-items: center;
    width: 1.5em;
}

#btn-quit:hover {
    background: linear-gradient(135deg, #a07820, #f5c842);
    color: #1a0e00;
    border-color: #ffe066ad;
}

#help-overlay,
#combo-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #0008;
    display: flex;
    align-items: center;
    justify-content: center;
}

#help-panel {
    border-radius: 0.3em;
    padding: 1.5em;
    max-width: 42em;
    width: 92%;
    max-height: 85vh;
    font-size: 1.5em;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

#help-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75em;
    flex-shrink: 0;
}

#help-title {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 1em;
    color: var(--text);
    padding-left: 1.5em;
    /* compense la largeur du bouton pour centrage optique */
}

#btn-help-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1em;
    cursor: pointer;
    flex-shrink: 0;
}

#btn-help-close:hover {
    color: var(--text);
}

#btn-help-close:active {
    transform: scale(0.88);
}

#btn-combo-detail-close {
    position: absolute;
    top: 0.7em;
    right: 0.8em;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1em;
    cursor: pointer;
}

#btn-combo-detail-close:hover {
    color: var(--text);
}

#help-tabs {
    display: flex;
    gap: 0.3em;
    margin-bottom: 1em;
    flex-shrink: 0;
}

.help-tab {
    flex: 1;
    padding: 0.4em 0;
    border: 0.071em solid var(--border);
    border-radius: 0.5em;
    background: var(--bg3);
    color: var(--muted);
    font-size: .8em;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.help-tab.active {
    background: linear-gradient(135deg, rgb(160, 120, 32), rgb(245, 200, 66));
    color: #fff;
    text-shadow: 0 1px 3px rgba(80, 35, 0, 0.75), 0 -1px 0 rgba(255, 230, 150, 0.3);
    border-color: rgb(200, 155, 40);
}

.help-tab-content {
    display: none;
    overflow-y: auto;
    flex: 1;
}

.help-tab-content.active {
    display: block;
}

.help-tab-content h3 {
    font-size: .9em;
    color: var(--accent2);
    margin: 0.8em 0 0.4em;
}

.help-tab-content h3:first-child {
    margin-top: 0;
}

.help-tab-content p,
.help-tab-content li {
    font-size: .82em;
    color: var(--muted);
    line-height: 1.5;
}

.help-tab-content ul,
.help-tab-content ol {
    padding-left: 1.2em;
    margin: 0.3em 0 0.8em;
}

.help-combo-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.8em;
    display: flex;
    flex-direction: column;
    gap: 0.35em;
}

.help-combo-item {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.35em 0.5em;
    border-radius: 0.5em;
    cursor: pointer;
    transition: background .12s;
}

.help-combo-item:hover {
    background: var(--bg3);
}

.help-swatch {
    width: 2.2em;
    height: 2.2em;
    border-radius: 0.3em;
    flex-shrink: 0;
}

.help-combo-name {
    font-weight: 700;
    font-size: 1em;
    min-width: 7.5em;
    color: var(--text);
}

.help-combo-rule {
    font-size: .9em;
    color: var(--muted);
    flex: 1;
}

.help-dice-mini {
    display: flex;
    align-items: center;
    gap: 0.15em;
    flex-shrink: 0;
}

.help-die-icon {
    width: 1.6em;
    height: 1.6em;
    border-radius: 0.2em;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1em;
    filter: invert(1);
    opacity: 0.75;
}

/* Dés dans l'overlay détail */
#combo-detail-dice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    flex-wrap: wrap;
}

.combo-detail-die {
    width: 2.75em;
    height: 2.75em;
    border-radius: 0.35em;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2em;
    filter: invert(1);
    border: 0.1em solid rgba(0, 0, 0, 0.4);
}

/* Highlight plateau */
/* Bouton aide sur les cases */
.cell-help-btn {
    position: absolute;
    bottom: 0.35em;
    right: 0.35em;
    width: 1.1em;
    height: 1.1em;
    border-radius: 0.25em;
    background: #000c;
    color: #fff;
    font-size: 1em;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
    padding: 0;
}

.cell:hover .cell-help-btn {
    opacity: 0.8;
}

.cell--dim {
    opacity: 0.2;
    transition: opacity .15s;
}

.cell--highlight {
    box-shadow: 0 0 0 0.2em #fff9, 0 0 1em 0.3em #fff3;
    transition: box-shadow .15s;
}

/* Overlay combinaison individuelle */
#combo-detail-panel {
    border-radius: 0.3em;
    padding: 1.8em 1.5em 1.5em;
    max-width: 24em;
    width: 88%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.95em;
    text-align: center;
}

#combo-detail-swatch {
    width: 6em;
    height: 6em;
    border-radius: 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.combo-detail-cell-label {
    font-size: .90em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    text-align: center;
    line-height: 1.2;
    letter-spacing: .04em;
}

.combo-detail-cell-label--big {
    font-size: 2em;
}

#combo-detail-name {
    font-size: 1.675em;
    color: var(--text);
    margin: 0;
}

#combo-detail-major {
    font-size: 1.2em;
    font-weight: 600;
    padding: 0.2em 0.6em;
    border-radius: 0.3em;
}

#combo-detail-rule {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--accent2);
    margin: 0;
}

#combo-detail-detail {
    font-size: 1.2em;
    color: var(--muted);
    line-height: 1.5;
    margin: 0;
}

/* ─── Tour guidé ─────────────────────────────────────────────────────────── */

#tour-highlight {
    position: fixed;
    z-index: 2000;
    border-radius: 0.6em;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
    border: 2px solid rgba(255, 215, 0, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s, left .3s, top .3s, width .3s, height .3s;
}

#tour-highlight.active {
    opacity: 1;
}

#tour-tooltip {
    position: fixed;
    z-index: 2001;
    width: 18em;
    background: rgba(12, 6, 28, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.3);
    border-radius: 0.75em;
    padding: 1.2em 1.4em;
    display: flex;
    flex-direction: column;
    gap: 0.8em;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    font-family: 'IM Fell English', serif;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    font-size: 1.2;
}

#tour-tooltip.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#tour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tour-title {
    font-weight: 700;
    font-size: 1em;
    color: #ffe066;
}

#tour-counter {
    font-size: .75em;
    color: var(--muted);
}

#tour-text {
    font-size: .88em;
    color: var(--text);
    line-height: 1.5;
    margin: 0;
}

#tour-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5em;
}

#tour-btn-skip {
    background: none;
    border: none;
    color: var(--muted);
    font-size: .75em;
    cursor: pointer;
    font-family: 'IM Fell English', serif;
    text-decoration: underline;
    padding: 0;
}

#tour-btn-skip:hover {
    color: var(--text);
}

#tour-btn-next {
    padding: 0.45em 1em;
    border-radius: 0.4em;
    border: 1px solid rgb(200, 155, 40);
    background: linear-gradient(135deg, rgb(160, 120, 32), rgb(245, 200, 66));
    color: #fff;
    text-shadow: 0 1px 3px rgba(80, 35, 0, 0.75), 0 -1px 0 rgba(255, 230, 150, 0.3);
    font-family: 'IM Fell English', serif;
    font-size: .85em;
    cursor: pointer;
}

#tour-btn-next:hover {
    background: linear-gradient(135deg, rgb(130, 95, 20), rgb(215, 170, 50));
}

/* Bouton tutoriel lobby */
#btn-tutorial {
    width: 100%;
    margin-top: 0.5em;
    font-size: .9em;
    opacity: 0.85;
}

#btn-tutorial:hover {
    opacity: 1;
}

#btn-tutorial,
#btn-tutorial-head {
    color: #c0c0c0;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    :root {
        --sidebar-w: 0em;
        --layout-gap: 0em;
    }

    #game-layout {
        flex-direction: column;
        align-items: center;
        padding: 0.5em;
    }

    #sidebar {
        width: 100%;
    }
}

/* @media (max-width: 900px) {
    :root {
        --sidebar-w: 0em;
        --layout-gap: 0em;
    }

    #game-layout {
        flex-direction: column;
        align-items: center;
        padding: 0.5em;
    }

    #sidebar {
        width: 100%;
    }
} */

@media (max-width: 480px) {
    :root {
        --cell-size: 3em;
    }

    .cell-label {
        font-size: .5em;
    }

    .die {
        width: 3.429em;
        height: 3.429em;
    }
}

@media (max-width: 360px) {
    .home_section {
        justify-content: center;
        text-align: center;
    }
}

/* ── Résumé de partie ───────────────────────────────────────────────────── */
#game-summary {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5em;
    margin-bottom: 0.4em;
}

.summary-stat {
    background: rgba(12, 6, 28, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-color: rgba(255, 255, 255, 0.18);
    border-radius: 0.3em;
    padding: 0.6em 0.4em;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.15em;
}

.summary-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #ffe066;
    text-shadow: 0 0 8px rgba(245, 185, 40, .4);
    margin-bottom: 0.5em;
}

.summary-label {
    font-size: 0.72em;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Séparateur médailles ───────────────────────────────────────────────── */
.medals-title {
    width: 100%;
    text-align: center;
    font-size: 0.78em;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.9em;
    margin-top: 0.3em;
}

/* ── Médailles fin de partie ────────────────────────────────────────────── */
#final-medals {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    width: 100%;
}

.medal-row {
    display: flex;
    align-items: center;
    gap: 0.7em;
    background: rgba(12, 6, 28, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-top-color: rgba(255, 255, 255, 0.14);
    border-radius: 0.3em;
    padding: 0.5em 0.8em;
}

.medal-icon {
    font-size: 1.4em;
    flex-shrink: 0;
}

.medal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.medal-label {
    font-weight: 700;
    font-size: 1.3em;
    color: var(--text);
}

.medal-winner {
    font-size: 1.1em;
    color: var(--muted);
    width: 70%;
    margin: 0.5em auto 0;
}

.medal-value {
    font-size: 1.2em;
    font-weight: 700;
    color: #ffe066;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Animations victoire ────────────────────────────────────────────────── */
@keyframes trophy-pop {
    from {
        transform: scale(0) rotate(-15deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.25) rotate(6deg);
        opacity: 1;
    }

    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.trophy-icon {
    display: inline-block;
    animation: trophy-pop 0.55s cubic-bezier(.34, 1.56, .64, 1) 0.35s both;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }

    80% {
        opacity: 0.85;
    }

    100% {
        transform: translateY(105vh) translateX(var(--confetti-drift)) rotate(var(--confetti-rot));
        opacity: 0;
    }
}

/* ─── About modal ─────────────────────────────────────────────────────────── */

.lobby-footer {
    margin-top: 1.5em;
    text-align: center;
}

.lobby-about-link {
    background: none;
    border: none;
    color: #6a4a8a;
    font-size: 0.78em;
    cursor: pointer;
    letter-spacing: 0.05em;
    padding: 0.3em 0.6em;
    transition: color 0.2s;
}

.lobby-about-link:hover {
    color: #c8a060;
}

#about-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #0008;
    display: flex;
    align-items: center;
    justify-content: center;
}

#about-panel {
    border-radius: 0.3em;
    padding: 1.5em;
    max-width: 36em;
    width: 92%;
    max-height: 85vh;
    font-size: 1.5em;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

#about-title {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 1em;
    color: var(--text);
    padding-left: 1.5em;
}

#about-body {
    overflow-y: auto;
    text-align: center;
}

.about-initials {
    display: flex;
    justify-content: center;
    gap: 0.4em;
    flex-wrap: wrap;
    margin: 0.5em 0 1em;
}

.about-initials span {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(200, 160, 96, 0.3);
    color: #c8a060;
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.25em 0.6em;
    border-radius: 2em;
}

.about-license {
    margin: 1.2em 0 0.4em;
    line-height: 1.8;
}

.about-license-badge {
    border-radius: 3px;
    opacity: 0.85;
}

.about-license-link {
    font-size: 0.78em;
    color: var(--muted);
    text-decoration: underline;
}

.about-license-link:hover { color: var(--accent2); }

.about-version {
    font-size: 0.72em;
    color: var(--muted);
    margin-top: 1em;
}

#btn-about-close {
    background: none;
    border: none;
    color: var(--accent2);
    font-size: 1.4em;
    cursor: pointer;
    flex-shrink: 0;
}

#btn-about-close:hover {
    color: var(--text);
}

#btn-about-close:active {
    transform: scale(0.88);
}

#btn-about-close {
    background: none;
}

#btn-about-close svg {
    width: 0.8em;
}