/* ═══════════════════════════════════════════════════════════════
   Ludo – UI layer on top of the 3D scene
   ═══════════════════════════════════════════════════════════════ */

:root {
    --l-bg: #090612;
    --l-glass: rgba(22, 15, 44, 0.72);
    --l-glass-strong: rgba(18, 12, 36, 0.88);
    --l-border: rgba(255, 255, 255, 0.12);
    --l-text: #f5f3ff;
    --l-muted: #a99fd1;
    --l-accent: #a855f7;
    --l-hot: #ec4899;
    --l-blue: #38bdf8;
    --l-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --l-safe-top: env(safe-area-inset-top, 0px);
    --l-safe-bottom: env(safe-area-inset-bottom, 0px);
    --l-font-display: 'Fredoka', 'Poppins', system-ui, sans-serif;
}

.ludo-preferences summary { cursor: pointer; font-weight: 700; }
.ludo-preferences p { margin-top: 0.75rem; }
.ludo-color-rank { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.35rem; }
.ludo-color-rank span { flex: 1; font-weight: 600; }
.ludo-color-rank button {
    border: 1px solid var(--l-border); border-radius: 0.5rem; background: var(--l-glass);
    color: var(--l-text); min-width: 36px; min-height: 36px; cursor: pointer;
}
.ludo-color-rank button:disabled { opacity: 0.3; cursor: default; }
.ludo-admin-console {
    position: fixed; right: 1rem; top: calc(4rem + var(--l-safe-top)); z-index: 45;
    width: min(340px, calc(100vw - 2rem)); max-height: calc(100dvh - 6rem); overflow-y: auto;
}
.ludo-admin-console h3 { padding-right: 1.5rem; }
.ludo-admin-console p { margin: 0.75rem 0 0; font-size: 0.8rem; }
.ludo-modechip--napoli { border-color: rgba(255, 128, 36, 0.5); }
.ludo-virus-layer, .ludo-virus-layer * { pointer-events: none !important; }
.ludo-virus-layer { position: fixed; inset: 0; z-index: 9; overflow: hidden; }
.ludo-virus-on .ludo-canvas {
    filter: saturate(1.25) contrast(1.15) drop-shadow(4px 0 #ff2d6f) drop-shadow(-4px 0 #2dfcf0);
    animation: ludoVirusCanvas 2.6s steps(1) infinite;
}
body.ludo-virus-on .ludo-topbar { animation: ludoVirusJitter 3.4s steps(1) infinite; }
.ludo-virus-layer::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(transparent 12%, #2dfcf055 12% 14%, transparent 14% 41%, #ff2d6f44 41% 43.5%, transparent 43.5% 71%, #9bff3740 71% 72%, transparent 72%);
    mix-blend-mode: screen;
    animation: ludoVirusBands 1.9s steps(1) infinite;
}
.ludo-virus-layer::before {
    content: ''; position: absolute; inset: 0;
    background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(116, 223, 35, 0.09) 3px 4px);
    animation: ludoVirusFlicker 0.18s steps(2) infinite;
}
.ludo-virus-face {
    position: absolute; top: 20%; right: 0; width: min(32vw, 280px); height: auto;
    opacity: 0.92; filter: drop-shadow(5px 0 #ff2d6f) drop-shadow(-5px 0 #2dfcf0) contrast(1.2);
    animation: ludoVirusFace 0.9s steps(1) infinite;
}
.ludo-virus-face[hidden] { display: none; }
.ludo-virus-error {
    position: absolute; width: min(290px, 44vw); border: 2px outset #e4e4e4; background: #c5c5c5;
    color: #171717; font-family: Tahoma, system-ui, sans-serif; font-size: 0.76rem;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35); opacity: 0.95;
    animation: ludoVirusPopup 0.25s steps(2) 1;
}
.ludo-virus-error b { display: block; background: linear-gradient(90deg, #12266c, #638bbf); color: white; padding: 0.3rem; }
.ludo-virus-error p { padding: 0.65rem 0.65rem 0.65rem 2.4rem; margin: 0; position: relative; }
.ludo-virus-error p::before { content: '✖'; position: absolute; left: 0.6rem; top: 0.5rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: #d11; color: white; display: grid; place-items: center; font-size: 0.7rem; }
/* Reduced motion: same glitch look, but static (no flashing animations). */
.ludo-virus-layer.is-reduced::before, .ludo-virus-layer.is-reduced::after,
.ludo-virus-layer.is-reduced .ludo-virus-face, .ludo-virus-layer.is-reduced .ludo-virus-error { animation: none; }
.ludo-virus-layer.is-reduced::after { opacity: 0.6; }
@keyframes ludoVirusCanvas {
    0%, 100% { transform: none; }
    18% { transform: translateX(-6px) skewX(1.5deg); filter: hue-rotate(80deg) saturate(1.6) drop-shadow(8px 0 #ff2d6f) drop-shadow(-8px 0 #2dfcf0); }
    21% { transform: none; }
    56% { transform: translate(5px, -2px); filter: invert(0.08) contrast(1.4) drop-shadow(-6px 0 #ff2d6f) drop-shadow(6px 0 #2dfcf0); }
    59% { transform: none; }
    83% { transform: skewY(-0.8deg) translateY(3px); filter: grayscale(0.5) contrast(1.6) drop-shadow(10px 0 #9bff37); }
    85% { transform: none; }
}
@keyframes ludoVirusJitter {
    0%, 100% { transform: none; }
    40% { transform: translateX(3px); }
    42% { transform: none; }
    77% { transform: translate(-4px, 1px); }
    79% { transform: none; }
}
@keyframes ludoVirusFace {
    0%, 100% { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
    25% { transform: translate(-8px, 3px) skewX(6deg); clip-path: inset(10% 0 35% 0); }
    30% { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
    60% { transform: translate(6px, -4px); clip-path: inset(48% 0 8% 0); }
    66% { transform: none; clip-path: inset(0 0 0 0); }
}
@keyframes ludoVirusBands {
    0%, 55%, 100% { opacity: 0; transform: translateY(0); }
    60% { opacity: 1; transform: translateY(-14%); }
    80% { opacity: 0.8; transform: translateY(12%); }
}
@keyframes ludoVirusFlicker { 0% { opacity: 0.6; } 100% { opacity: 1; } }
@keyframes ludoVirusPopup { 0% { transform: scale(0.9) translateX(-10px); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .ludo-virus-on .ludo-canvas, .ludo-virus-on .ludo-topbar,
    .ludo-virus-face, .ludo-virus-error, .ludo-virus-layer::before, .ludo-virus-layer::after { animation: none; }
}
* { box-sizing: border-box; }

/* Inline SVG icons (e.g. Terremoto): same size and baseline as an emoji. */
.ludo-ico { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
[data-icon] { font-style: normal; display: inline-flex; align-items: center; justify-content: center; }
.ludo-card__icon .ludo-ico { width: 1em; height: 1em; vertical-align: middle; }

html, body { height: 100%; }

.ludo-body {
    margin: 0;
    background: var(--l-bg);
    color: var(--l-text);
    font-family: 'Poppins', system-ui, sans-serif;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.ludo-stage { position: fixed; inset: 0; z-index: 0; }
.ludo-canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.ludo-vignette {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 55%, transparent 45%, rgba(5, 3, 14, 0.75) 100%),
        linear-gradient(to bottom, rgba(5, 3, 14, 0.55), transparent 16%, transparent 80%, rgba(5, 3, 14, 0.6));
}

[hidden] { display: none !important; }

/* Dim and blur the 3D backdrop behind menus so panels stay legible. */
.ludo-vignette { transition: background 0.6s, backdrop-filter 0.6s; }
body[data-screen-active='menu'] .ludo-vignette,
body[data-screen-active='lobby'] .ludo-vignette,
body[data-screen-active='auth'] .ludo-vignette,
body[data-screen-active='error'] .ludo-vignette {
    background: radial-gradient(ellipse at 50% 50%, rgba(9, 6, 18, 0.45), rgba(5, 3, 14, 0.85));
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* ── Loader ─────────────────────────────────────────────────── */
.ludo-loader {
    position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 1.4rem; background: var(--l-bg);
    transition: opacity 0.6s ease, visibility 0.6s;
}
.ludo-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.ludo-loader p { color: var(--l-muted); margin: 0; letter-spacing: 0.08em; }
.ludo-loader__dice {
    position: relative; width: 64px; height: 64px; border-radius: 16px; background: #fdf8ee;
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.6), inset 0 -4px 0 rgba(0, 0, 0, 0.1);
    animation: loaderSpin 1.4s var(--l-ease) infinite;
}
.ludo-loader__dice span {
    position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #17122a;
}
.ludo-loader__dice span:nth-child(1) { top: 12px; left: 12px; }
.ludo-loader__dice span:nth-child(2) { top: 12px; right: 12px; }
.ludo-loader__dice span:nth-child(3) { top: 27px; left: 12px; }
.ludo-loader__dice span:nth-child(4) { top: 27px; right: 12px; }
.ludo-loader__dice span:nth-child(5) { bottom: 12px; left: 12px; }
.ludo-loader__dice span:nth-child(6) { bottom: 12px; right: 12px; }
@keyframes loaderSpin {
    0% { transform: rotate(0) scale(1); }
    50% { transform: rotate(180deg) scale(1.15); }
    100% { transform: rotate(360deg) scale(1); }
}

/* ── Top bar ────────────────────────────────────────────────── */
.ludo-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center;
    justify-content: space-between; gap: 0.6rem; padding: calc(0.7rem + var(--l-safe-top)) 0.9rem 0.7rem;
    pointer-events: none;
}
.ludo-topbar > * { pointer-events: auto; }
.ludo-topbar__tools { display: flex; gap: 0.4rem; }

.ludo-chip {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.95rem; border-radius: 999px;
    background: var(--l-glass); border: 1px solid var(--l-border); color: var(--l-text);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); text-decoration: none; font-weight: 600;
    font-size: 0.85rem; cursor: pointer; font-family: inherit; transition: transform 0.2s, background 0.2s;
    white-space: nowrap; flex-shrink: 0;
}
.ludo-chip:hover { transform: translateY(-1px); background: rgba(40, 28, 78, 0.7); }
.ludo-chip--room { position: absolute; left: 50%; top: calc(0.7rem + var(--l-safe-top)); transform: translateX(-50%); }
.ludo-chip--room:hover { transform: translateX(-50%) translateY(-1px); }
.ludo-chip--room b { font-family: var(--l-font-display); letter-spacing: 0.18em; font-size: 1rem; color: #fde68a; }
.ludo-chip__label { color: var(--l-muted); font-weight: 500; }

.ludo-iconbtn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 50%; border: 1px solid var(--l-border); background: var(--l-glass); color: var(--l-text);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer; font-size: 1.05rem;
    transition: transform 0.2s var(--l-ease), background 0.2s, opacity 0.2s; font-family: inherit;
}
.ludo-iconbtn:hover { transform: scale(1.1); background: rgba(60, 40, 110, 0.75); }
.ludo-iconbtn:active { transform: scale(0.94); }
.ludo-iconbtn.is-off { opacity: 0.5; }
.ludo-iconbtn--lg { width: 48px; height: 48px; font-size: 1.3rem; }
.ludo-iconbtn--danger:hover { background: rgba(190, 40, 70, 0.8); }
.ludo-badge {
    position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--l-hot);
    color: #fff; font-size: 0.68rem; font-style: normal; font-weight: 700; display: flex; align-items: center;
    justify-content: center; padding: 0 4px;
}

/* ── Screens / panels ───────────────────────────────────────── */
.ludo-screen {
    position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
    padding: calc(4.2rem + var(--l-safe-top)) 1rem calc(1rem + var(--l-safe-bottom)); overflow-y: auto;
    animation: screenIn 0.5s ease both;
}
.ludo-screen--hud { padding: 0; overflow: hidden; pointer-events: none; display: block; }
.ludo-screen--hud > * { pointer-events: auto; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.ludo-panel {
    background: var(--l-glass); border: 1px solid var(--l-border); border-radius: 1.5rem; padding: 1.6rem;
    backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.ludo-panel h2, .ludo-panel h3 { margin: 0 0 0.6rem; font-family: var(--l-font-display); }
.ludo-panel p { color: var(--l-muted); line-height: 1.55; margin: 0 0 1rem; font-size: 0.92rem; }
.ludo-panel--narrow { max-width: 420px; text-align: center; }

.ludo-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.7rem 1.4rem;
    border-radius: 999px; border: 1px solid transparent; font-family: inherit; font-weight: 700; font-size: 0.95rem;
    color: #fff; cursor: pointer; text-decoration: none; transition: transform 0.2s var(--l-ease), box-shadow 0.25s, filter 0.2s;
}
.ludo-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); }
.ludo-btn:active:not(:disabled) { transform: scale(0.96); }
.ludo-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ludo-btn--primary {
    background: linear-gradient(135deg, #a855f7, #ec4899); box-shadow: 0 8px 28px rgba(168, 85, 247, 0.4);
}
.ludo-btn--primary:hover:not(:disabled) { box-shadow: 0 12px 36px rgba(236, 72, 153, 0.55); }
.ludo-btn--ghost { background: rgba(255, 255, 255, 0.08); border-color: var(--l-border); }
.ludo-btn--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.ludo-btn--lg { padding: 0.95rem 2rem; font-size: 1.1rem; }
.ludo-btn--sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.ludo-linkbtn {
    background: none; border: none; color: var(--l-muted); text-decoration: underline; cursor: pointer;
    font-family: inherit; font-size: 0.9rem; margin-top: 1rem;
}
.ludo-linkbtn:hover { color: #fff; }

.ludo-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; text-align: left; }
.ludo-field span { font-size: 0.78rem; color: var(--l-muted); font-weight: 600; letter-spacing: 0.04em; }
.ludo-field--inline { flex-direction: row; align-items: center; gap: 0.6rem; margin: 0; }
.ludo-field--inline span { white-space: nowrap; }
.ludo-body select, .ludo-body input[type='text'] {
    background: rgba(8, 5, 20, 0.6); border: 1px solid var(--l-border); color: var(--l-text); border-radius: 0.8rem;
    padding: 0.65rem 0.9rem; font-family: inherit; font-size: 0.95rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.ludo-body select:focus, .ludo-body input[type='text']:focus { border-color: var(--l-accent); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25); }
.ludo-body select:disabled { opacity: 0.6; }
.ludo-body select option { background: #1a1233; }

/* ── Menu ───────────────────────────────────────────────────── */
.ludo-menu { width: min(980px, 100%); text-align: center; margin: auto; }
.ludo-logo { display: flex; justify-content: center; gap: 0.15em; font-family: var(--l-font-display); font-weight: 700; font-size: clamp(3.6rem, 12vw, 7rem); line-height: 1; }
.ludo-logo__l {
    display: inline-block; color: var(--c); text-shadow: 0 4px 0 var(--d), 0 10px 30px color-mix(in srgb, var(--c) 60%, transparent);
    animation: logoBob 3s ease-in-out infinite;
}
.ludo-logo__l--r { --c: #ef4444; --d: #991b1b; }
.ludo-logo__l--g { --c: #22c55e; --d: #166534; animation-delay: 0.2s; }
.ludo-logo__l--y { --c: #facc15; --d: #a16207; animation-delay: 0.4s; }
.ludo-logo__l--b { --c: #3b82f6; --d: #1e40af; animation-delay: 0.6s; }
@keyframes logoBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }
.ludo-tagline { color: #d6cffa; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); margin: 0.6rem 0 1.6rem; }
.ludo-menu__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.1rem; text-align: left; }
.ludo-menu__resume { grid-column: 1 / -1; border-color: rgba(250, 204, 21, 0.4); display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ludo-menu__resume h3, .ludo-menu__resume p { margin: 0; }
.ludo-menu__resume p { flex: 1; }
.ludo-join { display: flex; gap: 0.6rem; }
.ludo-join input { flex: 1; min-width: 0; letter-spacing: 0.3em; text-align: center; font-weight: 700; text-transform: uppercase; }

/* ── Lobby ──────────────────────────────────────────────────── */
.ludo-lobby { width: min(980px, 100%); margin: auto; display: flex; flex-direction: column; gap: 1.2rem; }
.ludo-lobby__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ludo-lobby__head h2 { margin: 0; font-family: var(--l-font-display); font-size: 2rem; }
.ludo-lobby__code { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.ludo-lobby__code > span { color: var(--l-muted); font-size: 0.8rem; }
.ludo-lobby__code > button {
    background: var(--l-glass); border: 1px dashed rgba(253, 230, 138, 0.5); color: #fde68a; border-radius: 0.9rem;
    padding: 0.4rem 1rem; cursor: pointer; font-size: 1.5rem; letter-spacing: 0.25em; font-family: var(--l-font-display);
}
.ludo-lobby__share { display: flex; gap: 0.5rem; }
.ludo-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.ludo-seat {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1.2rem 1rem 1rem;
    border-radius: 1.4rem; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 26%, rgba(20, 14, 40, 0.94)), rgba(20, 14, 40, 0.92));
    border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); backdrop-filter: blur(16px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 0 0 var(--c); min-height: 220px; animation: seatIn 0.4s var(--l-ease) both;
}
.ludo-seat.is-empty { background: rgba(20, 14, 40, 0.78); border-style: dashed; opacity: 0.9; }
@keyframes seatIn { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
.ludo-seat__pawn {
    position: absolute; top: -14px; width: 28px; height: 28px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--cl), var(--c) 55%, var(--cd)); box-shadow: 0 4px 14px var(--c);
}
.ludo-seat__pawn--empty { background: rgba(255, 255, 255, 0.08); box-shadow: none; border: 2px dashed var(--c); }
.ludo-seat__name { font-weight: 700; font-size: 1.05rem; text-align: center; word-break: break-word; margin-top: 0.2rem; }
.ludo-seat__name--empty { color: var(--l-muted); font-weight: 500; margin-top: 1.4rem; }
.ludo-seat__tags { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: center; }
.ludo-seat__actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; margin-top: auto; padding-top: 0.5rem; }
.ludo-tag { font-size: 0.68rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-weight: 600; }
.ludo-tag--host { background: rgba(250, 204, 21, 0.2); color: #fde68a; }
.ludo-tag--me { background: rgba(56, 189, 248, 0.22); color: #bae6fd; }
.ludo-tag--off { background: rgba(239, 68, 68, 0.25); color: #fecaca; }
.ludo-lobby__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ludo-lobby__settings { display: flex; gap: 1rem; flex-wrap: wrap; }
.ludo-lobby__actions { display: flex; gap: 0.7rem; }
.ludo-lobby__hint { text-align: center; color: #d6cffa; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); margin: 0; font-size: 0.9rem; }

.ludo-avatar {
    width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: rgba(255, 255, 255, 0.12);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ludo-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ludo-avatar__emoji { font-size: 1.4rem; font-weight: 700; }
.ludo-avatar--lg { width: 78px; height: 78px; border: 3px solid var(--c); box-shadow: 0 0 24px color-mix(in srgb, var(--c) 55%, transparent); }
.ludo-avatar--lg .ludo-avatar__emoji { font-size: 2.2rem; }

/* ── HUD: player cards ──────────────────────────────────────── */
.ludo-pcard {
    position: absolute; display: flex; align-items: center; gap: 0.7rem; padding: 0.45rem 1rem 0.45rem 0.45rem;
    border-radius: 999px; background: var(--l-glass-strong); border: 1px solid var(--l-border);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); max-width: 46vw;
    transition: transform 0.4s var(--l-ease), box-shadow 0.4s, border-color 0.4s, opacity 0.3s;
    animation: seatIn 0.5s var(--l-ease) both;
}
.ludo-pcard--tl { top: calc(4.2rem + var(--l-safe-top)); left: 0.9rem; }
.ludo-pcard--tr { top: calc(4.2rem + var(--l-safe-top)); right: 0.9rem; flex-direction: row-reverse; padding: 0.45rem 0.45rem 0.45rem 1rem; text-align: right; }
.ludo-pcard--bl { bottom: calc(5.8rem + var(--l-safe-bottom)); left: 0.9rem; }
.ludo-pcard--br { bottom: calc(5.8rem + var(--l-safe-bottom)); right: 0.9rem; flex-direction: row-reverse; padding: 0.45rem 0.45rem 0.45rem 1rem; text-align: right; }
.ludo-pcard.is-offline { opacity: 0.55; }
.ludo-pcard.is-active {
    transform: scale(1.06); border-color: var(--c);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 60%, transparent), 0 0 36px color-mix(in srgb, var(--c) 55%, transparent);
}
.ludo-pcard__ring {
    position: relative; padding: 3px; border-radius: 50%; flex-shrink: 0;
    background: conic-gradient(var(--c) calc(var(--p, 1) * 360deg), rgba(255, 255, 255, 0.15) 0);
}
.ludo-pcard:not(.is-active) .ludo-pcard__ring { background: color-mix(in srgb, var(--c) 70%, transparent); }
.ludo-pcard.is-urgent .ludo-pcard__ring { animation: urgent 0.5s ease-in-out infinite alternate; }
@keyframes urgent { to { filter: drop-shadow(0 0 8px #ef4444) brightness(1.4); } }
.ludo-pcard__ring .ludo-avatar { border: 2px solid var(--l-bg); }
.ludo-pcard__info { min-width: 0; }
.ludo-pcard__name { font-weight: 700; font-size: 0.88rem; display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.ludo-pcard--tr .ludo-pcard__name, .ludo-pcard--br .ludo-pcard__name { justify-content: flex-end; }
.ludo-pcard__name [data-pname] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8rem; }
.ludo-pcard__name em { font-style: normal; font-size: 0.6rem; padding: 0.1rem 0.4rem; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: var(--cl); letter-spacing: 0.05em; }
.ludo-pcard__name em:empty { display: none; }
.ludo-pcard__pips { display: flex; gap: 4px; margin-top: 0.25rem; }
.ludo-pcard--tr .ludo-pcard__pips, .ludo-pcard--br .ludo-pcard__pips { justify-content: flex-end; }
.ludo-pcard__pips i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); transition: all 0.4s var(--l-ease); }
.ludo-pcard__pips i.is-on { background: var(--c); box-shadow: 0 0 10px var(--c); transform: scale(1.15); }
/* Journey progress */
.ludo-pcard__bar {
    position: relative; margin-top: 0.3rem; height: 12px; min-width: 120px; border-radius: 999px; overflow: hidden;
    background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
.ludo-pcard__fill {
    height: 100%; width: 0; border-radius: inherit; transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    background: linear-gradient(90deg, color-mix(in srgb, var(--c) 70%, #000), var(--c) 60%, var(--cl));
    box-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent);
}
.ludo-pcard__bar span {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; font-weight: 800;
    letter-spacing: 0.04em; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.ludo-pcard__trophy { font-size: 1rem; filter: drop-shadow(0 0 6px #fbbf24); animation: trophyPop 0.6s var(--l-ease) both, trophyShine 2.4s ease-in-out 0.6s infinite; }
@keyframes trophyPop { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }
@keyframes trophyShine { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(-8deg) scale(1.18); } }
.ludo-pcard.is-finished { border-color: rgba(250, 204, 21, 0.55); }
.ludo-pcard.is-finished .ludo-pcard__name em { background: rgba(250, 204, 21, 0.22); color: #fde68a; }

.ludo-pcard__reactions { position: absolute; left: 50%; top: -6px; width: 0; height: 0; pointer-events: none; }
.ludo-react { position: absolute; bottom: 0; left: -0.7em; font-size: 2rem; animation: reactUp 2.2s ease-out forwards; white-space: nowrap; font-weight: 800; }
@keyframes reactUp { 0% { transform: translateY(0) scale(0.3); opacity: 0; } 15% { transform: translateY(-14px) scale(1.4); opacity: 1; } 100% { transform: translateY(-80px) scale(1); opacity: 0; } }

/* ── HUD: action bar ────────────────────────────────────────── */
.ludo-actionbar {
    position: absolute; left: 50%; bottom: calc(1rem + var(--l-safe-bottom)); transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 0.6rem; width: max-content; max-width: 94vw;
}
.ludo-status {
    padding: 0.5rem 1.3rem; border-radius: 999px; background: var(--l-glass-strong); border: 1px solid var(--l-border);
    backdrop-filter: blur(14px); font-size: 0.92rem; color: var(--l-muted); text-align: center;
}
.ludo-status b { color: #fff; }
.ludo-roll {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.8rem 2.2rem; border-radius: 999px; border: none; cursor: pointer;
    font-family: var(--l-font-display); font-size: 1.35rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #6366f1, #a855f7 50%, #ec4899); box-shadow: 0 10px 34px rgba(168, 85, 247, 0.5);
    transition: transform 0.25s var(--l-ease), opacity 0.3s, filter 0.3s, box-shadow 0.3s;
}
.ludo-roll:disabled { opacity: 0.35; filter: grayscale(0.7); cursor: default; box-shadow: none; }
.ludo-roll.is-ready { animation: rollPulse 1.1s ease-in-out infinite; }
.ludo-roll:hover:not(:disabled) { transform: scale(1.07); }
.ludo-roll:active:not(:disabled) { transform: scale(0.95); }
.ludo-roll__icon { font-size: 1.6rem; display: inline-block; }
.ludo-roll.is-ready .ludo-roll__icon { animation: iconWobble 1.1s ease-in-out infinite; }
@keyframes rollPulse { 0%, 100% { box-shadow: 0 10px 34px rgba(168, 85, 247, 0.5); } 50% { box-shadow: 0 10px 60px rgba(236, 72, 153, 0.9), 0 0 0 8px rgba(236, 72, 153, 0.15); } }
@keyframes iconWobble { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(14deg) scale(1.1); } }

/* Automatic dice roll toggle */
.ludo-autoroll {
    display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.38rem 0.95rem; border-radius: 999px; cursor: pointer;
    font-family: var(--l-font-display); font-weight: 600; font-size: 0.85rem; color: var(--l-muted);
    background: var(--l-glass-strong); border: 1px solid var(--l-border); backdrop-filter: blur(14px);
    transition: transform 0.2s var(--l-ease), background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ludo-autoroll:hover { transform: translateY(-1px); background: rgba(40, 28, 78, 0.8); }
.ludo-autoroll b { font-weight: 800; letter-spacing: 0.04em; }
.ludo-autoroll.is-on {
    color: #fff; border-color: rgba(52, 211, 153, 0.85); background: linear-gradient(135deg, rgba(5, 150, 105, 0.85), rgba(16, 185, 129, 0.75));
    box-shadow: 0 0 18px rgba(52, 211, 153, 0.5);
}
.ludo-autoroll.is-on .ludo-autoroll__icon { display: inline-block; animation: autoSpin 2.4s linear infinite; }
@keyframes autoSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ludo-autoroll.is-on .ludo-autoroll__icon { animation: none; } }

/* ── Banner / popups ───────────────────────────────────────── */
.ludo-banner {
    position: absolute; top: calc(4.4rem + var(--l-safe-top)); left: 50%; transform-origin: 50% 0;
    transform: perspective(700px) translateX(-50%) translateY(-26px) rotateX(58deg) scale(0.92);
    opacity: 0; padding: 0.75rem 1.7rem; border-radius: 1.1rem; overflow: hidden;
    background:
        linear-gradient(168deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03) 40%, rgba(0, 0, 0, 0.3)),
        linear-gradient(135deg, rgba(76, 44, 140, 0.92), rgba(16, 10, 34, 0.94));
    border: 1px solid rgba(196, 181, 253, 0.45);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.55), 0 0 30px rgba(168, 85, 247, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 10px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px); font-weight: 600; text-align: center; max-width: 80vw; pointer-events: none !important;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.65);
    transition: opacity 0.3s, transform 0.5s cubic-bezier(0.2, 1.4, 0.35, 1); z-index: 3;
}
.ludo-banner::after {
    content: ''; position: absolute; inset: -40% -60%; pointer-events: none;
    background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.28) 50%, transparent 60%);
    transform: translateX(-130%);
}
.ludo-banner.is-in { opacity: 1; transform: perspective(700px) translateX(-50%) translateY(0) rotateX(0) scale(1); }
.ludo-banner.is-in::after { animation: chipShine 2.4s ease-out 0.15s both; }
.ludo-banner small { display: block; margin-top: 0.15rem; font-size: 0.72rem; font-weight: 500; color: var(--l-muted); font-family: 'Poppins', sans-serif; }
.ludo-banner--warn { border-color: rgba(250, 204, 21, 0.6); color: #fde68a; box-shadow: 0 18px 38px rgba(0, 0, 0, 0.55), 0 0 30px rgba(250, 204, 21, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.ludo-banner--win {
    border-color: rgba(250, 204, 21, 0.85); font-size: 1.4rem; font-family: var(--l-font-display);
    background:
        linear-gradient(168deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04) 40%, rgba(0, 0, 0, 0.3)),
        linear-gradient(135deg, rgba(120, 80, 10, 0.9), rgba(40, 20, 70, 0.94));
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), 0 0 44px rgba(250, 204, 21, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    animation: bannerGlow 1.6s ease-in-out infinite alternate;
}
@keyframes bannerGlow { to { box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), 0 0 60px rgba(250, 204, 21, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35); } }

/* Notifications: one stack centred above the dice, every line shares the same axis. */
.ludo-popstack {
    position: fixed; left: 0; top: 0; width: 0; z-index: 25; pointer-events: none;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.45rem;
    will-change: transform; perspective: 640px;
}
.ludo-pop {
    --pop: 196, 181, 253;
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap;
    font-family: var(--l-font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.2;
    padding: 0.45rem 1.15rem; border-radius: 0.9rem;
    background:
        linear-gradient(168deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03) 38%, rgba(0, 0, 0, 0.3)),
        linear-gradient(140deg, rgba(var(--pop), 0.2), rgba(12, 8, 26, 0.9) 60%);
    border: 1px solid rgba(var(--pop), 0.55);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5), 0 0 22px rgba(var(--pop), 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px); opacity: 0; transform: rotateX(-55deg) translateY(18px) scale(0.8); transform-origin: 50% 100%;
    transition: opacity 0.25s ease, transform 0.5s cubic-bezier(0.2, 1.5, 0.4, 1), max-height 0.4s ease, margin 0.4s ease, padding 0.4s ease;
    max-height: 4rem;
}
.ludo-pop::before {
    content: ''; position: absolute; inset: -40% -60%; pointer-events: none;
    background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
    transform: translateX(-130%);
}
.ludo-pop.is-in { opacity: 1; transform: none; }
.ludo-pop.is-in::before { animation: chipShine 1.4s ease-out 0.1s both; }
.ludo-pop.is-out { opacity: 0; transform: rotateX(40deg) translateY(-12px) scale(0.85); max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: -0.45rem; }
.ludo-pop--capture { --pop: 239, 68, 68; color: #fecaca; }
.ludo-pop--home { --pop: 34, 197, 94; color: #bbf7d0; }
.ludo-pop--ice { --pop: 56, 189, 248; color: #bae6fd; }
.ludo-pop--num { background: transparent; border: none; box-shadow: none; backdrop-filter: none; padding: 0; max-height: 5rem; overflow: visible; }
.ludo-pop--num::before { display: none; }
.ludo-pop__num {
    display: block; font-size: 3rem; line-height: 1; color: var(--c);
    text-shadow: 0 0 22px var(--c), 0 3px 0 rgba(0, 0, 0, 0.45); -webkit-text-stroke: 1px rgba(255, 255, 255, 0.35);
}
.ludo-pop--six .ludo-pop__num { font-size: 3.8rem; text-shadow: 0 0 34px var(--c), 0 0 12px #fde047, 0 3px 0 rgba(0, 0, 0, 0.45); }

/* Safety labels over the possible destinations */
.ludo-movetags { position: fixed; inset: 0; z-index: 24; pointer-events: none; overflow: hidden; }
.ludo-mtag {
    position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 0.3rem 0.7rem 0.35rem; border-radius: 0.8rem; white-space: nowrap; text-align: center; font-size: 0.78rem;
    background: rgba(10, 7, 22, 0.88); border: 1px solid var(--tc); color: #fff; backdrop-filter: blur(6px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 14px color-mix(in srgb, var(--tc) 45%, transparent);
    animation: mtagIn 0.35s var(--l-ease) both; will-change: transform;
}
.ludo-mtag::after {
    content: ''; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; background: inherit; border-right: 1px solid var(--tc);
    border-bottom: 1px solid var(--tc); transform: translateX(-50%) rotate(45deg);
}
.ludo-mtag b { font-weight: 700; color: var(--tc); }
.ludo-mtag small { color: var(--l-muted); font-size: 0.66rem; }
.ludo-mtag i { font-style: normal; font-weight: 800; font-size: 0.72rem; color: #fde047; }
.ludo-mtag--safe { --tc: #4ade80; }
.ludo-mtag--low { --tc: #fbbf24; }
.ludo-mtag--danger { --tc: #f87171; }
.ludo-mtag--ice { --tc: #7dd3fc; }
@keyframes mtagIn { from { opacity: 0; margin-top: 10px; } to { opacity: 1; margin-top: 0; } }

/* ── Chat / emotes ─────────────────────────────────────────── */
.ludo-social {
    position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column;
    align-items: flex-end; gap: 0.6rem;
}
.ludo-social__buttons { display: flex; flex-direction: column; gap: 0.5rem; }
.ludo-chat {
    position: absolute; right: 60px; top: 50%; transform: translateY(-50%); width: min(300px, 70vw); height: 260px; display: flex;
    flex-direction: column; border-radius: 1.2rem; background: var(--l-glass-strong); border: 1px solid var(--l-border);
    backdrop-filter: blur(16px); overflow: hidden; animation: seatIn 0.3s var(--l-ease) both;
}
.ludo-chat__list { flex: 1; overflow-y: auto; padding: 0.7rem; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; user-select: text; }
.ludo-chat__msg { line-height: 1.35; word-break: break-word; }
.ludo-chat__form { display: flex; gap: 0.4rem; padding: 0.5rem; border-top: 1px solid var(--l-border); }
.ludo-chat__form input { flex: 1; min-width: 0; padding: 0.5rem 0.8rem !important; font-size: 0.85rem !important; }
.ludo-chat__form .ludo-iconbtn { width: 38px; height: 38px; }
.ludo-emotes {
    position: absolute; right: 60px; top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem;
    padding: 0.5rem; border-radius: 1.2rem; background: var(--l-glass-strong); border: 1px solid var(--l-border); backdrop-filter: blur(16px);
    animation: seatIn 0.3s var(--l-ease) both;
}
.ludo-emotes button {
    width: 44px; height: 44px; border-radius: 0.8rem; border: none; background: rgba(255, 255, 255, 0.07); font-size: 1.4rem; cursor: pointer;
    color: #fff; font-weight: 800; font-size: 1.2rem; transition: transform 0.15s var(--l-ease), background 0.2s;
}
.ludo-emotes button:hover { transform: scale(1.2); background: rgba(255, 255, 255, 0.18); }

/* ── Countdown / overlays ──────────────────────────────────── */
.ludo-countdown { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(5, 3, 14, 0.55); pointer-events: none; }
.ludo-countdown span { font-family: var(--l-font-display); font-weight: 700; font-size: clamp(6rem, 24vw, 14rem); color: #fff; text-shadow: 0 0 50px var(--l-accent), 0 10px 0 rgba(168, 85, 247, 0.5); }
.ludo-countdown span.pop { animation: countPop 0.9s var(--l-ease) both; }
@keyframes countPop { 0% { transform: scale(2.4); opacity: 0; } 35% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.85); opacity: 0.25; } }

.ludo-overlay {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: rgba(5, 3, 14, 0.6); backdrop-filter: blur(6px); animation: screenIn 0.4s ease both;
}
.ludo-gameover { width: min(460px, 100%); text-align: center; position: relative; overflow: hidden; }
.ludo-gameover::before {
    content: ''; position: absolute; inset: -40% -20% auto; height: 80%; background: radial-gradient(circle, rgba(250, 204, 21, 0.28), transparent 65%); pointer-events: none;
}
.ludo-gameover h2 { font-size: 2rem; }
.ludo-gameover__crown { font-size: 3.6rem; animation: logoBob 2.4s ease-in-out infinite; }
.ludo-ranking { list-style: none; padding: 0; margin: 0 0 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; position: relative; }
.ludo-ranking li {
    display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.9rem; border-radius: 0.9rem; text-align: left;
    background: linear-gradient(90deg, color-mix(in srgb, var(--c) 24%, transparent), rgba(255, 255, 255, 0.05));
    border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.ludo-ranking__pos { width: 2rem; text-align: center; font-weight: 700; }
.ludo-ranking__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.ludo-ranking__name { flex: 1; font-weight: 600; }
.ludo-ranking__score { color: var(--l-muted); font-size: 0.8rem; }
.ludo-gameover__actions { display: flex; gap: 0.7rem; justify-content: center; }

.ludo-rules { width: min(560px, 100%); position: relative; max-height: 86vh; overflow-y: auto; }
.ludo-rules ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.6rem; color: var(--l-muted); font-size: 0.9rem; line-height: 1.5; }
.ludo-rules b { color: #fff; }
.ludo-rules kbd { background: rgba(255, 255, 255, 0.14); border-radius: 6px; padding: 0.05rem 0.45rem; font-size: 0.8rem; }
.ludo-rules__close { position: absolute; top: 0.8rem; right: 0.8rem; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.1); color: #fff; cursor: pointer; }

/* ── Avatar shop overlay ───────────────────────────────────── */
.ludo-menu__links { display: flex; gap: 1.2rem; justify-content: center; align-items: center; }
.ludo-avatarshop { width: min(860px, 100%); position: relative; max-height: 88vh; overflow-y: auto; }
.ludo-avatarshop__hint { color: var(--l-muted); font-size: 0.8rem; text-align: center; margin: 1rem 0 0; }

/* ── Toasts ────────────────────────────────────────────────── */
.ludo-toasts { position: fixed; bottom: calc(1rem + var(--l-safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.ludo-toast {
    padding: 0.65rem 1.3rem; border-radius: 999px; background: var(--l-glass-strong); border: 1px solid var(--l-border);
    backdrop-filter: blur(14px); font-size: 0.9rem; font-weight: 600; opacity: 0; transform: translateY(16px) scale(0.95);
    transition: opacity 0.3s, transform 0.4s var(--l-ease);
}
.ludo-toast.is-in { opacity: 1; transform: none; }
.ludo-toast--error { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }
.ludo-toast--success { border-color: rgba(34, 197, 94, 0.6); color: #bbf7d0; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 760px) {
    .ludo-topbar { padding-left: 0.5rem; padding-right: 0.5rem; }
    .ludo-iconbtn { width: 36px; height: 36px; font-size: 0.95rem; }
    .ludo-topbar__tools { gap: 0.25rem; }
    [data-tool='fullscreen'] { display: none; }
    .ludo-chip { padding: 0.45rem 0.75rem; }
    .ludo-chip__label, .ludo-chip__text { display: none; }
    .ludo-chip--link { padding: 0.45rem 0.9rem; font-size: 1.1rem; }
    .ludo-pcard { padding: 0.3rem 0.7rem 0.3rem 0.3rem; gap: 0.45rem; max-width: 44vw; }
    .ludo-pcard--tr, .ludo-pcard--br { padding: 0.3rem 0.3rem 0.3rem 0.7rem; }
    .ludo-pcard .ludo-avatar { width: 34px; height: 34px; }
    .ludo-pcard__name { font-size: 0.74rem; }
    .ludo-pcard__name [data-pname] { max-width: 5.2rem; }
    .ludo-pcard__pips i { width: 8px; height: 8px; border-width: 1.5px; }
    .ludo-pcard--tl, .ludo-pcard--tr { top: calc(3.6rem + var(--l-safe-top)); }
    .ludo-pcard--bl, .ludo-pcard--br { bottom: calc(6.6rem + var(--l-safe-bottom)); }
    .ludo-pcard--tl, .ludo-pcard--bl { left: 0.5rem; }
    .ludo-pcard--tr, .ludo-pcard--br { right: 0.5rem; }
    .ludo-roll { padding: 0.65rem 1.8rem; font-size: 1.15rem; }
    .ludo-status { font-size: 0.82rem; padding: 0.4rem 1rem; }
    .ludo-social { right: 0.4rem; }
    .ludo-iconbtn--lg { width: 40px; height: 40px; font-size: 1.1rem; }
    .ludo-chat, .ludo-emotes { right: 48px; }
    .ludo-lobby__foot { flex-direction: column; align-items: stretch; }
    .ludo-lobby__actions { justify-content: stretch; }
    .ludo-lobby__actions .ludo-btn { flex: 1; }
    .ludo-seat { min-height: 190px; }
    .ludo-seats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-height: 520px) and (orientation: landscape) {
    .ludo-screen { padding-top: 3.4rem; }
    .ludo-actionbar { flex-direction: row; gap: 0.8rem; }
    .ludo-status { display: none; }
    .ludo-pcard--bl, .ludo-pcard--br { bottom: 0.6rem; }
    .ludo-pcard--tl, .ludo-pcard--tr { top: 3.2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .ludo-logo__l, .ludo-roll.is-ready, .ludo-roll.is-ready .ludo-roll__icon { animation: none; }
}

/* ── Map selector ───────────────────────────────────────────── */
.ludo-maps { display: flex; gap: 0.7rem; }
.ludo-map {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.45rem; padding: 0.55rem; border-radius: 1rem;
    background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; color: var(--l-text); cursor: pointer; font-family: inherit;
    transition: transform 0.2s var(--l-ease), border-color 0.2s, background 0.2s;
}
.ludo-map:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255, 255, 255, 0.12); }
.ludo-map:disabled { cursor: default; opacity: 0.75; }
.ludo-map.is-active { border-color: var(--l-accent); background: rgba(168, 85, 247, 0.18); box-shadow: 0 0 22px rgba(168, 85, 247, 0.35); }
.ludo-map b { font-size: 0.82rem; }
.ludo-map__thumb {
    position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; max-width: 150px; border-radius: 0.6rem; overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.ludo-map__thumb--classic {
    background:
        linear-gradient(#ef4444, #ef4444) 0 0 / 38% 40% no-repeat,
        linear-gradient(#22c55e, #22c55e) 100% 0 / 38% 40% no-repeat,
        linear-gradient(#facc15, #facc15) 100% 100% / 38% 40% no-repeat,
        linear-gradient(#3b82f6, #3b82f6) 0 100% / 38% 40% no-repeat,
        #ece3d0;
    border: 3px solid #d9a93a;
}
.ludo-map__thumb--cross {
    background:
        linear-gradient(#ef4444, #ef4444) 0 0 / 38% 40% no-repeat,
        linear-gradient(#22c55e, #22c55e) 100% 0 / 38% 40% no-repeat,
        linear-gradient(#facc15, #facc15) 100% 100% / 38% 40% no-repeat,
        linear-gradient(#3b82f6, #3b82f6) 0 100% / 38% 40% no-repeat,
        #ece3d0;
    border: 3px solid #d9a93a;
}
.ludo-map__thumb--hex {
    border-radius: 0; box-shadow: none; overflow: visible; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
    background: conic-gradient(from 0deg at 50% 50%, #ef4444 0 60deg, #f97316 0 120deg, #facc15 0 180deg, #22c55e 0 240deg, #3b82f6 0 300deg, #a855f7 0 360deg);
    clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
    max-width: 120px;
}
.ludo-map__thumb--wood {
    background:
        linear-gradient(#c8573f, #c8573f) 0 0 / 38% 40% no-repeat,
        linear-gradient(#5a9a52, #5a9a52) 100% 0 / 38% 40% no-repeat,
        linear-gradient(#d4a93a, #d4a93a) 100% 100% / 38% 40% no-repeat,
        linear-gradient(#4a74b8, #4a74b8) 0 100% / 38% 40% no-repeat,
        repeating-linear-gradient(7deg, rgba(90, 50, 20, 0.3) 0 2px, transparent 2px 7px),
        linear-gradient(135deg, #ebcb94, #c99a5b 55%, #e2bd82);
    border: 3px solid #5c3416;
    box-shadow: inset 0 0 0 2px #c9a24a, 0 4px 14px rgba(0, 0, 0, 0.4);
}
.ludo-lobby__maps { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.ludo-lobby__maps-label { color: #d6cffa; font-weight: 600; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); }
.ludo-lobby__maps .ludo-maps { min-width: 280px; }
.ludo-lobby__maps .ludo-map__thumb { max-width: 110px; }

/* ── Audio panel ────────────────────────────────────────────── */
.ludo-audio-wrap { position: relative; }
.ludo-audio {
    position: absolute; right: 0; top: calc(100% + 0.5rem); width: 260px; padding: 0.9rem; border-radius: 1.1rem;
    background: var(--l-glass-strong); border: 1px solid var(--l-border); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    display: flex; flex-direction: column; gap: 0.8rem; animation: seatIn 0.25s var(--l-ease) both; z-index: 40;
}
.ludo-audio__row { display: flex; align-items: center; gap: 0.7rem; }
.ludo-audio__slider { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.ludo-audio__slider label { display: flex; justify-content: space-between; font-size: 0.78rem; font-weight: 600; color: var(--l-text); }
.ludo-audio__slider label span { color: var(--l-muted); font-weight: 500; }
.ludo-audio input[type='range'] {
    -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; outline: none; cursor: pointer;
    background: linear-gradient(90deg, var(--l-accent), var(--l-hot)); opacity: 0.95;
}
.ludo-audio input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--l-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); transition: transform 0.15s var(--l-ease);
}
.ludo-audio input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.2); }
.ludo-audio input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--l-accent); }

/* ── Performance: no live blur over the animated 3D canvas while playing ── */
body[data-screen-active='game'] {
    --l-glass: rgba(22, 15, 44, 0.9);
    --l-glass-strong: rgba(18, 12, 36, 0.94);
}
body[data-screen-active='game'] .ludo-chip,
body[data-screen-active='game'] .ludo-iconbtn,
body[data-screen-active='game'] .ludo-pcard,
body[data-screen-active='game'] .ludo-status,
body[data-screen-active='game'] .ludo-banner,
body[data-screen-active='game'] .ludo-pop,
body[data-screen-active='game'] .ludo-mtag,
body[data-screen-active='game'] .ludo-chat,
body[data-screen-active='game'] .ludo-emotes,
body[data-screen-active='game'] .ludo-toast,
body[data-screen-active='game'] .ludo-audio {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ── Game modes: HUD chips ─────────────────────────────────── */
.ludo-modebar {
    position: absolute; top: calc(3.7rem + var(--l-safe-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 0.6rem;
    z-index: 4; pointer-events: none !important; perspective: 620px;
}
.ludo-modechip {
    --chip: 196, 181, 253;
    position: relative; overflow: hidden; display: flex; align-items: center; gap: 0.55rem;
    padding: 0.38rem 0.95rem 0.38rem 0.55rem; border-radius: 0.95rem;
    background:
        linear-gradient(168deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 36%, rgba(0, 0, 0, 0.28) 100%),
        linear-gradient(135deg, rgba(var(--chip), 0.22), rgba(12, 8, 26, 0.9) 55%);
    border: 1px solid rgba(var(--chip), 0.55);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(var(--chip), 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -3px 8px rgba(0, 0, 0, 0.45);
    transform-style: preserve-3d;
    animation: chipIn 0.6s var(--l-ease) both, chipFloat 3.8s ease-in-out 0.6s infinite;
}
.ludo-modechip:nth-child(2n) { animation-delay: 0.08s, 1.2s; }
.ludo-modechip:nth-child(3n) { animation-delay: 0.16s, 2.1s; }
.ludo-modechip::after {
    content: ''; position: absolute; inset: -40% -60%; pointer-events: none;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.34) 50%, transparent 62%);
    transform: translateX(-130%) rotate(0.001deg);
    animation: chipShine 4.6s ease-in-out 1.2s infinite;
}
@keyframes chipIn { from { opacity: 0; transform: rotateX(70deg) translateY(-14px) scale(0.7); } to { opacity: 1; transform: rotateX(12deg) translateY(0) scale(1); } }
@keyframes chipFloat {
    0%, 100% { transform: rotateX(12deg) translateY(0); }
    50% { transform: rotateX(12deg) translateY(-2.5px); }
}
@keyframes chipShine { 0% { transform: translateX(-130%); } 32%, 100% { transform: translateX(130%); } }
.ludo-modechip__icon {
    font-size: 1.45rem; transform: translateZ(14px);
    filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(var(--chip), 0.55));
    animation: chipIcon 2.8s ease-in-out infinite;
}
@keyframes chipIcon { 0%, 100% { transform: translateZ(14px) rotate(-5deg) scale(1); } 50% { transform: translateZ(14px) rotate(6deg) scale(1.12); } }
.ludo-modechip__text { display: flex; flex-direction: column; line-height: 1.1; transform: translateZ(8px); }
.ludo-modechip__text b { font-family: var(--l-font-display); font-size: 1.02rem; font-variant-numeric: tabular-nums; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.65), 0 0 12px rgba(var(--chip), 0.5); }
.ludo-modechip__text small { font-size: 0.62rem; color: var(--l-muted); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.ludo-modechip--bomb { --chip: 239, 68, 68; }
.ludo-modechip--bomb.is-urgent { animation: chipIn 0.6s var(--l-ease) both, bombPulse 0.5s ease-in-out infinite alternate; }
.ludo-modechip--bomb.is-urgent b { color: #fca5a5; }
.ludo-modechip--cards { --chip: 251, 191, 36; }
.ludo-modechip--ice { --chip: 125, 211, 252; }
.ludo-modechip--ice b { color: #bae6fd; }
.ludo-modechip--slope { --chip: 251, 146, 60; }
.ludo-modechip--slope b { color: #fed7aa; }
@keyframes bombPulse { to { box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5), 0 0 26px rgba(239, 68, 68, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.28); transform: rotateX(12deg) scale(1.06); } }
body.ludo-has-modes .ludo-banner { top: calc(7rem + var(--l-safe-top)); }

/* Status badges on the player cards */
.ludo-pcard__badges { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-top: 0.25rem; }
.ludo-pcard__badges:empty { display: none; }
.ludo-pcard--tr .ludo-pcard__badges, .ludo-pcard--br .ludo-pcard__badges { justify-content: flex-end; }
.ludo-badgechip {
    font-size: 0.62rem; font-weight: 700; padding: 0.08rem 0.4rem; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
    color: #fff; white-space: nowrap;
}
.ludo-badgechip--good { background: rgba(34, 197, 94, 0.3); }
.ludo-badgechip--bad { background: rgba(239, 68, 68, 0.32); }

/* Extra safety tags */
.ludo-mtag--hole { --tc: #ef4444; }
.ludo-mtag em { font-style: normal; font-weight: 700; font-size: 0.68rem; color: #fbbf24; }

/* ── Pause ─────────────────────────────────────────────────── */
.ludo-pausebox { width: min(380px, 100%); text-align: center; }
.ludo-pausebox__icon { font-size: 3rem; margin-bottom: 0.3rem; }
.ludo-iconbtn--pause { background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(168, 85, 247, 0.5)); }

/* ── Lobby: modes ──────────────────────────────────────────── */
.ludo-lobby__modes { display: flex; flex-direction: column; gap: 0.8rem; align-items: center; }
.ludo-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.8rem; width: 100%; }
.ludo-mode {
    position: relative; display: flex; gap: 0.8rem; align-items: center; padding: 0.8rem 1rem; border-radius: 1rem; cursor: pointer;
    background: rgba(20, 14, 40, 0.8); border: 2px solid var(--l-border); transition: transform 0.2s var(--l-ease), border-color 0.2s, background 0.2s;
}
.ludo-mode:hover { transform: translateY(-2px); }
.ludo-mode input { position: absolute; opacity: 0; pointer-events: none; }
.ludo-mode.is-on { border-color: var(--l-accent); background: rgba(168, 85, 247, 0.2); box-shadow: 0 0 22px rgba(168, 85, 247, 0.3); }
.ludo-mode.is-locked { cursor: default; }
.ludo-mode.is-locked:hover { transform: none; }
.ludo-mode__icon { font-size: 2rem; }
.ludo-mode__body { display: flex; flex-direction: column; gap: 0.15rem; }
.ludo-mode__body b { font-family: var(--l-font-display); font-size: 1.05rem; }
.ludo-mode__body small { color: var(--l-muted); font-size: 0.72rem; line-height: 1.35; }
.ludo-mode.is-on::after {
    content: '✓ ATTIVA'; position: absolute; top: 0.4rem; right: 0.7rem; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.06em; color: #d8b4fe;
}
.ludo-modeopts { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; align-items: center; }
.ludo-modeopts input[type='number'] { width: 5.5rem; }

/* ── Card reveal ───────────────────────────────────────────── */
.ludo-cardreveal {
    position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; background: rgba(5, 3, 14, 0.55);
    perspective: 1200px; animation: screenIn 0.3s ease both; cursor: pointer;
}
.ludo-card { width: min(260px, 70vw); aspect-ratio: 5 / 7; position: relative; animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.ludo-card__flip { position: absolute; inset: 0; animation: cardFlip 0.9s ease-in-out 0.25s both; }
.ludo-card__face {
    position: absolute; inset: 0; border-radius: 1.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 1.2rem; gap: 0.5rem;
}
/* A 2D flip (scale + swap at the half-way point) is used on purpose: it never depends on 3D transform support. */
.ludo-card__face--back {
    background: linear-gradient(160deg, #5b21b6, #1e1040); border: 4px solid #f5b83c; box-shadow: 0 0 40px rgba(251, 191, 36, 0.5);
    font-family: var(--l-font-display); font-size: 7rem; color: #fbbf24; text-shadow: 0 0 24px rgba(251, 191, 36, 0.9);
    animation: faceBack 0.9s steps(1, end) 0.25s both;
}
.ludo-card__face--front {
    border: 4px solid var(--cc); background: linear-gradient(170deg, color-mix(in srgb, var(--cc) 35%, #1a1033), #120a26 70%);
    box-shadow: 0 0 60px color-mix(in srgb, var(--cc) 65%, transparent); animation: faceFront 0.9s steps(1, end) 0.25s both;
}
.ludo-card--buff { --cc: #22c55e; }
.ludo-card--debuff { --cc: #ef4444; }
.ludo-card--doom { --cc: #ff2a1a; }
.ludo-card--doom .ludo-card__face--back { background: linear-gradient(160deg, #3b0a12, #0a0306); border-color: #ff2a1a; color: #ff6b4a; box-shadow: 0 0 50px rgba(255, 42, 26, 0.7); }
.ludo-card--doom .ludo-card__face--front {
    background: radial-gradient(circle at 50% 40%, #4a0d14, #0a0306 75%); box-shadow: 0 0 90px rgba(255, 42, 26, 0.85); animation: faceFront 0.9s steps(1, end) 0.25s both, doomShake 0.5s linear 1.2s infinite;
}
.ludo-card--doom .ludo-card__ribbon { background: linear-gradient(90deg, #7f1d1d, #ff2a1a, #7f1d1d); animation: bombPulse 0.6s ease-in-out infinite alternate; }
.ludo-card--doom .ludo-card__face h3 { color: #ff6b4a; text-shadow: 0 0 18px rgba(255, 42, 26, 0.9); }
.ludo-card--ice { --cc: #38bdf8; }
.ludo-card--ice .ludo-card__face--back { background: linear-gradient(160deg, #0b3a5c, #030c18); border-color: #38bdf8; color: #bae6fd; box-shadow: 0 0 50px rgba(56, 189, 248, 0.7); }
.ludo-card--ice .ludo-card__face--front {
    background: radial-gradient(circle at 50% 40%, #0e4a73, #030c18 75%); box-shadow: 0 0 90px rgba(56, 189, 248, 0.85); animation: faceFront 0.9s steps(1, end) 0.25s both;
}
.ludo-card--ice .ludo-card__ribbon { background: linear-gradient(90deg, #075985, #38bdf8, #075985); animation: bombPulse 0.6s ease-in-out infinite alternate; }
.ludo-card--ice .ludo-card__face h3 { color: #bae6fd; text-shadow: 0 0 18px rgba(56, 189, 248, 0.9); }
.ludo-cardreveal.is-ice { background: radial-gradient(circle at 50% 50%, rgba(8, 70, 110, 0.55), rgba(3, 8, 20, 0.82)); }
.ludo-cardreveal.is-doom { background: radial-gradient(circle at 50% 50%, rgba(120, 10, 10, 0.55), rgba(5, 3, 14, 0.8)); }
.ludo-card__ribbon { position: absolute; top: 0.9rem; font-style: normal; font-weight: 800; font-size: 0.7rem; letter-spacing: 0.18em; padding: 0.2rem 0.8rem; border-radius: 999px; background: var(--cc); color: #fff; }
.ludo-card__icon { font-size: 4.6rem; line-height: 1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); margin-top: 1.2rem; animation: logoBob 2.2s ease-in-out infinite; }
.ludo-card__face h3 { margin: 0; font-family: var(--l-font-display); font-size: 1.6rem; }
.ludo-card__face p { margin: 0; color: #d6cffa; font-size: 0.85rem; line-height: 1.4; }
.ludo-card__face small { position: absolute; bottom: 0.9rem; color: var(--l-muted); font-size: 0.7rem; }
@keyframes cardIn { from { transform: translateY(80px) scale(0.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cardFlip { 0% { transform: scaleX(1); } 50% { transform: scaleX(0.02); } 100% { transform: scaleX(1); } }
@keyframes faceBack { 0%, 49.9% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes faceFront { 0%, 49.9% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes doomShake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-2px, 1px); } 50% { transform: translate(2px, -1px); } 75% { transform: translate(-1px, -2px); } }

@media (max-width: 760px) {
    .ludo-modebar { top: calc(3.3rem + var(--l-safe-top)); gap: 0.3rem; }
    .ludo-modechip { padding: 0.2rem 0.6rem 0.2rem 0.4rem; }
    .ludo-modechip__text b { font-size: 0.85rem; }
    .ludo-modechip__text small { display: none; }
    body.ludo-has-modes .ludo-pcard--tl, body.ludo-has-modes .ludo-pcard--tr { top: calc(5.9rem + var(--l-safe-top)); }
    body.ludo-has-modes .ludo-banner { top: calc(8.6rem + var(--l-safe-top)); }
}
body[data-screen-active='game'] .ludo-modechip, body[data-screen-active='game'] .ludo-mode { backdrop-filter: none; }

.ludo-iconbtn.is-active { background: linear-gradient(135deg, #6366f1, #a855f7); border-color: rgba(255, 255, 255, 0.5); box-shadow: 0 0 18px rgba(168, 85, 247, 0.7); opacity: 1; }
.ludo-mtag em.is-doom { color: #ff6b4a; text-shadow: 0 0 8px rgba(255, 42, 26, 0.9); }

/* ── Cursed-card options (lobby) ─────────────────────────────── */
.ludo-doomopts { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; margin-top: 0.8rem; }
.ludo-doomopts__label { font-size: 0.8rem; color: var(--l-muted); text-align: center; }

/* ── Six-player board: extra HUD positions ───────────────────── */
.ludo-pcard--ml { top: 50%; left: 0.9rem; margin-top: -2.2rem; }
.ludo-pcard--mr { top: 50%; right: 0.9rem; margin-top: -2.2rem; flex-direction: row-reverse; padding: 0.45rem 0.45rem 0.45rem 1rem; text-align: right; }
.ludo-pcard--mr .ludo-pcard__name { justify-content: flex-end; }
.ludo-pcard--mr .ludo-pcard__pips { justify-content: flex-end; }
.ludo-pcard--mr .ludo-pcard__badges { justify-content: flex-end; }
@media (max-width: 760px) {
    .ludo-pcard--ml, .ludo-pcard--mr { margin-top: -1.8rem; }
    .ludo-pcard--ml { left: 0.5rem; }
    .ludo-pcard--mr { right: 0.5rem; padding: 0.3rem 0.3rem 0.3rem 0.7rem; }
}
@media (max-height: 560px) {
    body.ludo-six .ludo-pcard { transform: scale(0.82); }
    body.ludo-six .ludo-pcard--ml, body.ludo-six .ludo-pcard--tl, body.ludo-six .ludo-pcard--bl { transform-origin: left center; }
    body.ludo-six .ludo-pcard--mr, body.ludo-six .ludo-pcard--tr, body.ludo-six .ludo-pcard--br { transform-origin: right center; }
}

/* ── Card kept in hand + shrink chip ─────────────────────────── */
.ludo-handcard {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.2rem; border-radius: 999px; cursor: pointer;
    font-family: var(--l-font-display); font-weight: 700; font-size: 0.95rem; color: #fff7ed; border: 2px solid rgba(251, 146, 60, 0.9);
    background: linear-gradient(135deg, #9a3412, #ea580c); box-shadow: 0 0 22px rgba(251, 146, 60, 0.55); animation: bombPulse 1s ease-in-out infinite alternate;
}
.ludo-handcard[hidden] { display: none; }
.ludo-handcard:disabled { animation: none; opacity: 0.55; box-shadow: none; cursor: default; filter: saturate(0.6); }
.ludo-handcard__icon { font-size: 1.3rem; }
.ludo-modechip--shrink { --chip: 251, 146, 60; }
.ludo-modechip--shrink b { color: #fed7aa; }
.ludo-modechip--shrink.is-urgent { animation: chipIn 0.6s var(--l-ease) both, bombPulse 0.5s ease-in-out infinite alternate; }
.ludo-modechip--shrink.is-urgent b { color: #fca5a5; }

/* Six players: keep the side cards clear of the social buttons */
body.ludo-six .ludo-pcard--ml, body.ludo-six .ludo-pcard--mr { top: 37%; }
body.ludo-six .ludo-social { top: 64%; }

.ludo-modechip--dance { --chip: 236, 72, 153; }
.ludo-modechip--dance b { color: #fbcfe8; }

/* ── Four maps, pawn selector, room clock ───────────────────── */
.ludo-maps { flex-wrap: wrap; }
.ludo-map { flex: 1 1 calc(50% - 0.7rem); min-width: 110px; }
.ludo-lobby__maps .ludo-maps { min-width: 280px; max-width: 560px; }
.ludo-lobby__maps .ludo-map { flex: 1 1 calc(25% - 0.7rem); min-width: 105px; }
.ludo-map__thumb--classic-nature {
    background:
        radial-gradient(circle at 18% 70%, #1f6b46 0 14%, transparent 15%),
        radial-gradient(circle at 84% 62%, #2c8a55 0 12%, transparent 13%),
        linear-gradient(#ef4444, #ef4444) 22% 30% / 20% 24% no-repeat,
        linear-gradient(#22c55e, #22c55e) 58% 30% / 20% 24% no-repeat,
        linear-gradient(#facc15, #facc15) 58% 62% / 20% 24% no-repeat,
        linear-gradient(#3b82f6, #3b82f6) 22% 62% / 20% 24% no-repeat,
        linear-gradient(#ece3d0, #ece3d0) 18% 22% / 66% 56% no-repeat,
        linear-gradient(to bottom, #1c1f4a 0, #5a3f8a 40%, #2d6a4f 41%, #14452f);
    border: 3px solid #3a2a6e;
}
.ludo-map__thumb--wood-nature {
    background:
        radial-gradient(circle at 16% 72%, #2e7d32 0 15%, transparent 16%),
        radial-gradient(circle at 86% 66%, #43a047 0 13%, transparent 14%),
        linear-gradient(#c8573f, #c8573f) 24% 30% / 18% 22% no-repeat,
        linear-gradient(#5a9a52, #5a9a52) 58% 30% / 18% 22% no-repeat,
        linear-gradient(#d4a93a, #d4a93a) 58% 62% / 18% 22% no-repeat,
        linear-gradient(#4a74b8, #4a74b8) 24% 62% / 18% 22% no-repeat,
        linear-gradient(135deg, #ebcb94, #c99a5b) 18% 22% / 66% 56% no-repeat,
        linear-gradient(to bottom, #7ec8f2 0, #cfeefc 42%, #6bbf59 43%, #3f8f3a);
    border: 3px solid #5c3416;
}
.ludo-map__thumb--realistic {
    background:
        radial-gradient(circle at 70% 30%, #f4ecdc 0 4%, transparent 5%),
        radial-gradient(circle at 30% 68%, #3b6aa8 0 5%, transparent 6%),
        linear-gradient(#9c3b2b, #9c3b2b) 24% 30% / 18% 22% no-repeat,
        linear-gradient(#44804d, #44804d) 58% 30% / 18% 22% no-repeat,
        linear-gradient(#c19230, #c19230) 58% 62% / 18% 22% no-repeat,
        linear-gradient(#35599a, #35599a) 24% 62% / 18% 22% no-repeat,
        linear-gradient(135deg, #d9b98a, #b78f5f) 16% 18% / 70% 62% no-repeat,
        repeating-linear-gradient(4deg, rgba(25, 14, 7, 0.35) 0 2px, transparent 2px 6px),
        linear-gradient(160deg, #6b4a33, #3a271b);
    border: 3px solid #4a3020;
}
.ludo-seg { display: inline-flex; gap: 0.3rem; padding: 0.25rem; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--l-border); }
.ludo-seg__btn {
    min-width: 2.3rem; padding: 0.45rem 0.8rem; border-radius: 999px; border: none; background: transparent; color: var(--l-text);
    font-family: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: background 0.2s, transform 0.2s var(--l-ease);
}
.ludo-seg__btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.ludo-seg__btn:disabled { cursor: default; opacity: 0.7; }
.ludo-seg__btn.is-active { background: linear-gradient(135deg, var(--l-accent), var(--l-hot)); box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4); }
.ludo-chip__clock {
    font-size: 0.72rem; font-weight: 600; color: var(--l-muted); padding: 0.1rem 0.5rem; border-radius: 999px;
    background: rgba(255, 255, 255, 0.08); font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}

/* ── Profile & statistics ───────────────────────────────────── */
.ludo-profile { width: min(640px, 100%); position: relative; max-height: 88vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.3) transparent; }
.ludo-profile__tabs { display: inline-flex; gap: 0.3rem; margin-bottom: 1rem; padding: 0.25rem; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
.ludo-profile__head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.ludo-profile__head .ludo-avatar { width: 72px; height: 72px; flex: none; }
.ludo-profile__name { font-family: var(--l-font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.ludo-profile__sub { color: var(--l-muted); font-size: 0.82rem; margin-top: 0.25rem; }
.ludo-profile__badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.ludo-pbadge { padding: 0.15rem 0.6rem; border-radius: 999px; background: rgba(168, 85, 247, 0.22); border: 1px solid rgba(168, 85, 247, 0.5); font-size: 0.72rem; font-weight: 600; }
.ludo-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.55rem; margin-bottom: 1rem; }
.ludo-stat { padding: 0.65rem 0.75rem; border-radius: 0.9rem; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--l-border); }
.ludo-stat b { display: block; font-family: var(--l-font-display); font-size: 1.35rem; line-height: 1.1; }
.ludo-stat small { color: var(--l-muted); font-size: 0.72rem; }
.ludo-stat--hl { background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(236, 72, 153, 0.22)); }
.ludo-profile h4 { margin: 1rem 0 0.5rem; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: #d6cffa; }
.ludo-bars { display: flex; flex-direction: column; gap: 0.35rem; }
.ludo-bar { display: grid; grid-template-columns: 2.6rem 1fr 2.4rem; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--l-muted); }
.ludo-bar i { display: block; height: 9px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ludo-bar i::after { content: ''; display: block; height: 100%; width: var(--w, 0%); border-radius: 5px; background: linear-gradient(90deg, var(--l-accent), var(--l-hot)); transition: width 0.6s var(--l-ease); }
.ludo-bar span:last-child { text-align: right; color: #fff; font-weight: 600; }
.ludo-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ludo-history li { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: 0.6rem; padding: 0.45rem 0.7rem; border-radius: 0.8rem; background: rgba(255, 255, 255, 0.05); font-size: 0.82rem; }
.ludo-history__pos { font-weight: 800; text-align: center; font-size: 1.05rem; }
.ludo-history small { color: var(--l-muted); display: block; }
.ludo-history .is-win { color: #fde68a; }
.ludo-top { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ludo-top li { display: grid; grid-template-columns: 2rem 36px 1fr auto; align-items: center; gap: 0.6rem; padding: 0.4rem 0.7rem; border-radius: 0.8rem; background: rgba(255, 255, 255, 0.05); cursor: pointer; }
.ludo-top li:hover { background: rgba(255, 255, 255, 0.11); }
.ludo-top .ludo-avatar { width: 36px; height: 36px; }
.ludo-top small { color: var(--l-muted); }
.ludo-profile__empty { text-align: center; color: var(--l-muted); padding: 1.5rem 0; }
.ludo-pcard__ring, .ludo-seat .ludo-avatar, .ludo-ranking li { cursor: pointer; }
.ludo-ranking__stats { display: block; color: var(--l-muted); font-size: 0.7rem; font-weight: 400; }

/* ── New cards: Pedina Extra, Nostalgia, Taglia, black tiles ─────────── */
.ludo-card__face p.is-long { font-size: 0.72rem; line-height: 1.3; }
.ludo-card--extra { --cc: #d946ef; }
.ludo-card--extra .ludo-card__face--back { background: linear-gradient(160deg, #4a044e, #12041a); border-color: #d946ef; color: #f0abfc; box-shadow: 0 0 50px rgba(217, 70, 239, 0.75); }
.ludo-card--extra .ludo-card__face--front {
    background: radial-gradient(circle at 50% 38%, #5b1a6e, #12041a 75%); box-shadow: 0 0 90px rgba(217, 70, 239, 0.85);
    animation: faceFront 0.9s steps(1, end) 0.25s both, doomShake 0.5s linear 1.2s infinite;
}
.ludo-card--extra .ludo-card__ribbon { background: linear-gradient(90deg, #86198f, #d946ef, #86198f); animation: bombPulse 0.6s ease-in-out infinite alternate; }
.ludo-card--extra .ludo-card__face h3 { color: #f0abfc; text-shadow: 0 0 18px rgba(217, 70, 239, 0.95); }
.ludo-cardreveal.is-extra { background: radial-gradient(circle at 50% 50%, rgba(134, 25, 143, 0.55), rgba(8, 3, 14, 0.85)); }

.ludo-card--nostalgia { --cc: #d6d3d1; }
.ludo-card--nostalgia .ludo-card__face--back { background: linear-gradient(160deg, #44403c, #0c0a09); border-color: #e7e5e4; color: #e7e5e4; box-shadow: 0 0 50px rgba(231, 229, 228, 0.55); filter: grayscale(1); }
.ludo-card--nostalgia .ludo-card__face--front {
    background: radial-gradient(circle at 50% 38%, #57534e, #0c0a09 78%); box-shadow: 0 0 90px rgba(231, 229, 228, 0.6);
    filter: grayscale(1) contrast(1.1); animation: faceFront 0.9s steps(1, end) 0.25s both, filmFlicker 0.18s steps(2) 1.2s infinite;
}
.ludo-card--nostalgia .ludo-card__ribbon { background: linear-gradient(90deg, #44403c, #d6d3d1, #44403c); color: #0c0a09; }
.ludo-card--nostalgia .ludo-card__face h3 { color: #f5f5f4; font-style: italic; text-shadow: 0 0 14px rgba(255, 255, 255, 0.6); }
.ludo-card--nostalgia .ludo-card__icon { filter: grayscale(1) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6)); }
.ludo-cardreveal.is-nostalgia { background: radial-gradient(circle at 50% 50%, rgba(120, 113, 108, 0.45), rgba(4, 4, 4, 0.9)); backdrop-filter: grayscale(1); -webkit-backdrop-filter: grayscale(1); }
@keyframes filmFlicker { 0% { opacity: 1; } 50% { opacity: 0.93; transform: translateX(0.5px); } 100% { opacity: 1; } }

.ludo-mtag--black { --tc: #d6d3d1; }
.ludo-modechip--nostalgia { --chip: 231, 229, 228; }
.ludo-modechip--nostalgia b { color: #f5f5f4; }

/* Old film look while Nostalgia lasts: heavier vignette, grain and a faint flicker over the picture */
body.ludo-nostalgia .ludo-vignette {
    background:
        radial-gradient(ellipse at 50% 50%, transparent 38%, rgba(0, 0, 0, 0.78) 100%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
    animation: filmFlicker 0.12s steps(2) infinite;
}
body.ludo-nostalgia .ludo-vignette::after {
    content: ''; position: absolute; inset: 0; opacity: 0.5;
    background: linear-gradient(90deg, transparent 0 18%, rgba(255, 255, 255, 0.18) 18.2%, transparent 18.5% 63%, rgba(255, 255, 255, 0.12) 63.1%, transparent 63.3%);
    animation: filmScratch 1.7s steps(6) infinite;
}
@keyframes filmScratch { 0% { transform: translateX(0); } 33% { transform: translateX(7vw); } 66% { transform: translateX(-11vw); } 100% { transform: translateX(3vw); } }
@media (prefers-reduced-motion: reduce) { body.ludo-nostalgia .ludo-vignette, body.ludo-nostalgia .ludo-vignette::after { animation: none; } }

/* ── Rapimento: helipad tile tag and mode chip ───────────────────────── */
.ludo-mtag--kidnap { --tc: #f59e0b; }
.ludo-modechip--kidnap { --chip: 245, 158, 11; }
.ludo-modechip--kidnap b { color: #fcd34d; }

/* ── Super cards: Jackpot (gold) and Buco nero (void) ───────────────── */
.ludo-card--jackpot { --cc: #facc15; }
.ludo-card--jackpot .ludo-card__face--back { background: linear-gradient(160deg, #854d0e, #1c1204); border-color: #fde047; color: #fde047; box-shadow: 0 0 60px rgba(250, 204, 21, 0.8); }
.ludo-card--jackpot .ludo-card__face--front {
    background: radial-gradient(circle at 50% 38%, #a16207, #271a03 78%); box-shadow: 0 0 110px rgba(250, 204, 21, 0.95);
    animation: faceFront 0.9s steps(1, end) 0.25s both, jackpotShine 1.4s ease-in-out 1.2s infinite;
}
.ludo-card--jackpot .ludo-card__ribbon { background: linear-gradient(90deg, #a16207, #fde047, #a16207); color: #3b2a02; animation: bombPulse 0.5s ease-in-out infinite alternate; }
.ludo-card--jackpot .ludo-card__face h3 { color: #fde047; text-shadow: 0 0 20px rgba(250, 204, 21, 1); font-size: 1.9rem; }
.ludo-card--jackpot .ludo-card__icon { font-size: 5.4rem; filter: drop-shadow(0 0 18px rgba(250, 204, 21, 0.9)); }
.ludo-cardreveal.is-jackpot { background: radial-gradient(circle at 50% 50%, rgba(202, 138, 4, 0.6), rgba(10, 6, 2, 0.88)); }
@keyframes jackpotShine { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.28) saturate(1.2); } }

.ludo-card--blackhole { --cc: #a855f7; }
.ludo-card--blackhole .ludo-card__face--back { background: linear-gradient(160deg, #2e1065, #000); border-color: #a855f7; color: #d8b4fe; box-shadow: 0 0 60px rgba(168, 85, 247, 0.8); }
.ludo-card--blackhole .ludo-card__face--front {
    background: radial-gradient(circle at 50% 40%, #000 8%, #2e1065 55%, #07010f 85%); box-shadow: 0 0 110px rgba(168, 85, 247, 0.9);
    animation: faceFront 0.9s steps(1, end) 0.25s both, doomShake 0.5s linear 1.2s infinite;
}
.ludo-card--blackhole .ludo-card__ribbon { background: linear-gradient(90deg, #4c1d95, #a855f7, #4c1d95); animation: bombPulse 0.5s ease-in-out infinite alternate; }
.ludo-card--blackhole .ludo-card__face h3 { color: #e9d5ff; text-shadow: 0 0 20px rgba(168, 85, 247, 1); font-size: 1.9rem; }
.ludo-card--blackhole .ludo-card__icon { font-size: 5.4rem; animation: holeSpin 3s linear infinite; filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.9)); }
.ludo-cardreveal.is-blackhole { background: radial-gradient(circle at 50% 50%, rgba(88, 28, 135, 0.6), rgba(0, 0, 0, 0.92)); }
@keyframes holeSpin { to { transform: rotate(-360deg) scale(1); } }

/* ── Frana: cracked earth, trembling card ──────────────────────────── */
.ludo-card--landslide { --cc: #d97706; }
.ludo-card--landslide .ludo-card__face--back { background: linear-gradient(160deg, #78350f, #1c0a02); border-color: #f59e0b; color: #fcd34d; box-shadow: 0 0 60px rgba(217, 119, 6, 0.75); }
.ludo-card--landslide .ludo-card__face--front {
    background:
        repeating-linear-gradient(115deg, transparent 0 18px, rgba(0, 0, 0, 0.28) 18px 20px),
        radial-gradient(circle at 50% 35%, #92400e, #2a1304 72%);
    box-shadow: 0 0 100px rgba(217, 119, 6, 0.8);
    animation: faceFront 0.9s steps(1, end) 0.25s both, landslideShake 0.35s linear 1.2s infinite;
}
.ludo-card--landslide .ludo-card__ribbon { background: linear-gradient(90deg, #78350f, #f59e0b, #78350f); color: #2a1304; animation: bombPulse 0.5s ease-in-out infinite alternate; }
.ludo-card--landslide .ludo-card__face h3 { color: #fde68a; text-shadow: 0 0 18px rgba(245, 158, 11, 1); font-size: 1.9rem; }
.ludo-card--landslide .ludo-card__icon { font-size: 5rem; animation: landslideDrop 1.1s ease-in 1.2s infinite; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.7)); }
.ludo-cardreveal.is-landslide { background: radial-gradient(circle at 50% 60%, rgba(120, 53, 15, 0.6), rgba(10, 4, 1, 0.92)); }
@keyframes landslideShake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-2px, 1px); } 50% { transform: translate(2px, -1px); } 75% { transform: translate(-1px, -2px); } }
@keyframes landslideDrop { 0% { transform: translateY(-10px) rotate(-8deg); } 55% { transform: translateY(6px) rotate(4deg); } 70% { transform: translateY(0) rotate(0); } 100% { transform: translateY(0) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .ludo-card--landslide .ludo-card__face--front { animation: faceFront 0.9s steps(1, end) 0.25s both; } .ludo-card--landslide .ludo-card__icon { animation: none; } }
.ludo-modechip--landslide { --chip: 245, 158, 11; }
.ludo-modechip--landslide b { color: #fde68a; }
.ludo-pop--landslide { --pop: 245, 158, 11; color: #fde68a; }

/* ── Modalità Squadre ─────────────────────────────────────────── */
.ludo-tag--team { background: color-mix(in srgb, var(--tc, #c4b5fd) 22%, transparent); color: var(--tc, #ddd6fe); border: 1px solid color-mix(in srgb, var(--tc, #c4b5fd) 45%, transparent); }
.ludo-seat__teams { display: flex; gap: 0.4rem; justify-content: center; margin-top: 0.4rem; }
.ludo-teambtn {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.65rem; border-radius: 0.7rem; cursor: pointer;
    font: 600 0.72rem 'Poppins', sans-serif; color: #e5e7eb; background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.ludo-teambtn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--tc); }
.ludo-teambtn.is-active {
    border-color: var(--tc); color: #fff;
    background: color-mix(in srgb, var(--tc) 28%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--tc) 45%, transparent);
}
.ludo-teambtn:disabled { cursor: default; opacity: 0.85; }
.ludo-teambtn:disabled:not(.is-active) { opacity: 0.45; }
.ludo-pcard__team {
    font-style: normal; display: inline-flex; align-items: center; gap: 0.2rem; flex-shrink: 0;
    font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; padding: 0.08rem 0.45rem 0.08rem 0.3rem; border-radius: 999px;
    color: #fff; background: color-mix(in srgb, var(--tc, #c4b5fd) 30%, rgba(0, 0, 0, 0.35));
    border: 1px solid color-mix(in srgb, var(--tc, #c4b5fd) 65%, transparent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--tc, #c4b5fd) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.ludo-pcard__team u { text-decoration: none; }
/* Tinta di squadra sull'intera card: bordo e bagliore laterale */
.ludo-pcard--team-a, .ludo-pcard--team-b { border-width: 1px; }
.ludo-pcard--team-a { --tc: #f87171; box-shadow: inset 4px 0 0 -1px var(--tc), 0 0 16px rgba(248, 113, 113, 0.22); }
.ludo-pcard--team-b { --tc: #60a5fa; box-shadow: inset 4px 0 0 -1px var(--tc), 0 0 16px rgba(96, 165, 250, 0.22); }
.ludo-pcard--tr.ludo-pcard--team-a, .ludo-pcard--br.ludo-pcard--team-a, .ludo-pcard--mr.ludo-pcard--team-a { box-shadow: inset -4px 0 0 -1px var(--tc), 0 0 16px rgba(248, 113, 113, 0.22); }
.ludo-pcard--tr.ludo-pcard--team-b, .ludo-pcard--br.ludo-pcard--team-b, .ludo-pcard--mr.ludo-pcard--team-b { box-shadow: inset -4px 0 0 -1px var(--tc), 0 0 16px rgba(96, 165, 250, 0.22); }
.ludo-pcard--team-a.is-active, .ludo-pcard--team-b.is-active {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 60%, transparent), 0 0 36px color-mix(in srgb, var(--c) 55%, transparent), inset 4px 0 0 -1px var(--tc);
}
.ludo-ranking li.is-winner-team { box-shadow: 0 0 16px rgba(250, 204, 21, 0.35); border-color: rgba(250, 204, 21, 0.6); }

/* Recap dei premi del quiz: resta appuntato in alto per 10 secondi */
.ludo-quizrecap {
    position: absolute; top: calc(8.6rem + var(--l-safe-top)); left: 50%; z-index: 3; pointer-events: none;
    min-width: 230px; padding: 0.55rem 0.8rem 0.7rem; border-radius: 1rem; overflow: hidden;
    background:
        linear-gradient(168deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.03) 40%, rgba(0, 0, 0, 0.3)),
        linear-gradient(140deg, rgba(76, 44, 140, 0.9), rgba(14, 9, 30, 0.94));
    border: 1px solid rgba(250, 204, 21, 0.5);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5), 0 0 26px rgba(168, 85, 247, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    opacity: 0; transform: perspective(700px) translateX(-50%) translateY(-18px) rotateX(50deg) scale(0.9); transform-origin: 50% 0;
    transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 1.4, 0.35, 1);
}
.ludo-quizrecap.is-in { opacity: 1; transform: perspective(700px) translateX(-50%) translateY(0) rotateX(0) scale(1); }
body.ludo-has-modes .ludo-quizrecap { top: calc(11rem + var(--l-safe-top)); }
.ludo-quizrecap__title {
    font: 700 0.72rem 'Fredoka', sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: #fde047;
    text-shadow: 0 0 12px rgba(250, 204, 21, 0.6); margin-bottom: 0.4rem; text-align: center;
}
.ludo-quizrecap__row {
    display: flex; align-items: center; gap: 0.45rem; padding: 0.28rem 0.5rem; border-radius: 0.6rem; margin-top: 0.25rem;
    font: 600 0.8rem 'Poppins', sans-serif; color: #fff; background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.ludo-quizrecap__row.is-win { border-color: rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.1); }
.ludo-quizrecap__row.is-lose { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.1); }
.ludo-quizrecap__kind { font-size: 1rem; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.ludo-quizrecap__row b { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ludo-quizrecap__prize { margin-left: auto; font-weight: 700; color: #fef9c3; white-space: nowrap; }
.ludo-quizrecap__clock {
    display: block; height: 3px; margin-top: 0.5rem; border-radius: 99px; transform-origin: left;
    background: linear-gradient(90deg, #a855f7, #fde047); animation: recapClock 10s linear forwards;
}
@keyframes recapClock { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── Modalità Quiz ────────────────────────────────────────────── */
.ludo-modechip--quiz { --chip: 168, 85, 247; }
.ludo-modechip--quiz b { color: #e9d5ff; }
.ludo-mtag em.is-quiz { color: #e9d5ff; text-shadow: 0 0 8px rgba(168, 85, 247, 0.9); }

.ludo-overlay--quiz { align-items: flex-start; background: rgba(5, 3, 14, 0.55); z-index: 60; }
.ludo-quizbox {
    width: min(620px, 100%); margin-top: clamp(1rem, 8vh, 4.5rem); padding: 1rem 1.2rem 1.1rem; border-radius: 1.2rem;
    background: linear-gradient(160deg, rgba(49, 18, 95, 0.96), rgba(17, 8, 38, 0.97));
    border: 2px solid rgba(250, 204, 21, 0.5); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(168, 85, 247, 0.35);
    animation: quizIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes quizIn { from { transform: translateY(-30px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.ludo-quizbox__head { display: flex; align-items: center; gap: 0.6rem; }
.ludo-quizbox__mic { font-size: 1.5rem; animation: logoBob 2s ease-in-out infinite; }
.ludo-quizbox__title { font: 700 1.2rem 'Fredoka', sans-serif; letter-spacing: 0.12em; color: #fde047; text-shadow: 0 0 14px rgba(250, 204, 21, 0.7); }
.ludo-quizbox__timer {
    margin-left: auto; min-width: 2.4rem; text-align: center; padding: 0.15rem 0.5rem; border-radius: 0.7rem;
    font: 700 1.25rem 'Fredoka', sans-serif; color: #fff; background: rgba(168, 85, 247, 0.3); border: 1px solid rgba(168, 85, 247, 0.6);
}
.ludo-quizbox.is-urgent .ludo-quizbox__timer { color: #fecaca; border-color: #ef4444; background: rgba(239, 68, 68, 0.3); animation: bombPulse 0.4s ease-in-out infinite alternate; }
.ludo-quizbox__bar { height: 7px; margin: 0.55rem 0 0.7rem; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.ludo-quizbox__bar i { display: block; height: 100%; border-radius: 99px; transform-origin: left; background: linear-gradient(90deg, #a855f7, #fde047); transition: transform 0.15s linear; }
.ludo-quizbox.is-urgent .ludo-quizbox__bar i { background: linear-gradient(90deg, #ef4444, #f97316); }
.ludo-quizbox__q { margin: 0 0 0.75rem; font: 600 1.08rem/1.4 'Poppins', sans-serif; color: #fff; }
.ludo-quizbox__answers { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
.ludo-quizans {
    display: flex; align-items: center; gap: 0.55rem; padding: 0.55rem 0.7rem; border-radius: 0.8rem; cursor: pointer; text-align: left;
    font: 600 0.92rem 'Poppins', sans-serif; color: #f3e8ff; background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(196, 181, 253, 0.35); transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.ludo-quizans i {
    flex: none; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 0.5rem; font-style: normal;
    font: 700 0.8rem 'Fredoka', sans-serif; color: #2e1065; background: #fde047;
}
.ludo-quizans:hover:not(:disabled) { transform: translateY(-2px); border-color: #fde047; background: rgba(250, 204, 21, 0.14); }
.ludo-quizans:disabled { cursor: default; opacity: 0.55; }
.ludo-quizbox:not(.is-open) .ludo-quizans { filter: grayscale(0.4); }
.ludo-quizans.is-mine { opacity: 1; border-color: #38bdf8; background: rgba(56, 189, 248, 0.18); box-shadow: 0 0 14px rgba(56, 189, 248, 0.4); }
.ludo-quizans.is-correct { opacity: 1; border-color: #4ade80; background: rgba(74, 222, 128, 0.2); box-shadow: 0 0 16px rgba(74, 222, 128, 0.45); animation: quizPop 0.4s ease; }
.ludo-quizans.is-wrong { opacity: 1; border-color: #ef4444; background: rgba(239, 68, 68, 0.2); animation: quizShake 0.4s ease; }
@keyframes quizPop { 50% { transform: scale(1.05); } }
@keyframes quizShake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.ludo-quizbox.is-timeout .ludo-quizbox__q::after { content: ' ⏰ Tempo scaduto!'; color: #fca5a5; font-weight: 700; }
.ludo-quizbox__who { display: flex; gap: 0.45rem; margin-top: 0.75rem; flex-wrap: wrap; }
.ludo-quizwho {
    position: relative; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%;
    font: 700 0.8rem 'Poppins', sans-serif; color: #fff; background: color-mix(in srgb, var(--c) 35%, #1e1233);
    border: 2px solid color-mix(in srgb, var(--c) 60%, transparent); opacity: 0.55; transition: opacity 0.2s ease, box-shadow 0.2s ease;
}
.ludo-quizwho.is-in { opacity: 1; box-shadow: 0 0 12px var(--c); }
.ludo-quizwho.is-right { border-color: #4ade80; box-shadow: 0 0 12px rgba(74, 222, 128, 0.7); }
.ludo-quizwho.is-bad { border-color: #ef4444; box-shadow: 0 0 12px rgba(239, 68, 68, 0.6); }
.ludo-quizwho.is-silent { opacity: 0.4; filter: grayscale(0.8); }
.ludo-quizwho em { position: absolute; top: -7px; right: -7px; font-style: normal; font-size: 0.62rem; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8)); }
.ludo-quizwho small { position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%); font-size: 0.58rem; color: var(--l-muted); white-space: nowrap; }
.ludo-quizbox__result { margin-top: 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; animation: quizIn 0.3s ease both; }
.ludo-quizprize {
    display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; padding: 0.55rem 0.75rem; border-radius: 0.9rem;
    font: 600 0.88rem 'Poppins', sans-serif; color: #fff; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14);
}
.ludo-quizprize--win { border-color: rgba(74, 222, 128, 0.55); background: rgba(74, 222, 128, 0.1); }
.ludo-quizprize--lose { border-color: rgba(239, 68, 68, 0.55); background: rgba(239, 68, 68, 0.1); }
.ludo-quizprize__card { display: flex; flex-direction: column; gap: 0.1rem; flex: 1 1 100%; padding-left: 0.2rem; }
.ludo-quizprize__card b { font-size: 0.92rem; }
.ludo-quizprize__card small { color: var(--l-muted); font-weight: 500; line-height: 1.3; }

@media (max-width: 560px) {
    .ludo-quizbox { margin-top: 0.6rem; padding: 0.8rem 0.85rem 0.9rem; }
    .ludo-quizbox__q { font-size: 0.98rem; }
}
