/* ===== Self-hosted Lexend font ===== */
@font-face { font-family: 'Lexend'; font-weight: 400; font-display: swap; src: url('fonts/lexend-400.ttf') format('truetype'); }
@font-face { font-family: 'Lexend'; font-weight: 500; font-display: swap; src: url('fonts/lexend-500.ttf') format('truetype'); }
@font-face { font-family: 'Lexend'; font-weight: 600; font-display: swap; src: url('fonts/lexend-600.ttf') format('truetype'); }
@font-face { font-family: 'Lexend'; font-weight: 700; font-display: swap; src: url('fonts/lexend-700.ttf') format('truetype'); }
@font-face { font-family: 'Lexend'; font-weight: 800; font-display: swap; src: url('fonts/lexend-800.ttf') format('truetype'); }

/* ===== Rotate Device Overlay ===== */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #0f0f23;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #f8fafc;
    font-family: 'Lexend', sans-serif;
    text-align: center;
    padding: 40px;
}
#rotate-overlay .rotate-icon {
    font-size: 4rem;
    animation: rotate-hint 1.5s ease-in-out infinite;
}
#rotate-overlay p {
    font-size: 1.1rem;
    color: #94a3b8;
    max-width: 260px;
    line-height: 1.5;
}
#rotate-overlay strong {
    display: block;
    font-size: 1.4rem;
    color: #f59e0b;
    margin-bottom: 8px;
}
@keyframes rotate-hint {
    0%, 100% { transform: rotate(0deg); }
    40% { transform: rotate(90deg); }
    60% { transform: rotate(90deg); }
}
/* Portrait overlay disabilitato — ora gestiamo il layout verticale */
/* @media (max-width: 1024px) and (orientation: portrait) { #rotate-overlay { display: flex; } } */

/* ===== CSS Reset & Variables ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Refined Identity Palette - Modern Midnight (Slate + Soft Blue + Indigo) */
    --bg-dark: #070b19; /* Deeper midnight blue for higher contrast */
    --bg-panel: rgba(15, 23, 42, 0.85); /* Slate 900 Glass */
    --accent-primary: #00f2ff; /* Neon Cyan */
    --accent-secondary: #ff00d4; /* Neon Pink/Magenta */
    --accent-tertiary: #a855f7; /* Vibrant Purple */
    --accent-gold: #fbbf24; /* Amber Gold */
    --accent-pink: #ec4899; /* Pink */
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    
    --tile-bg: #1e293b; /* Slate 800 for hidden tiles */
    --tile-border: rgba(255, 255, 255, 0.1);
    --tile-glow: rgba(56, 189, 248, 0.2);
    
    --font-main: 'Lexend', sans-serif;
    --font-display: 'Lexend', sans-serif;

    /* Glow Effects */
    --glow-blue: 0 0 20px rgba(0, 212, 255, 0.5);
    --glow-purple: 0 0 20px rgba(139, 92, 246, 0.5);
    --glow-gold: 0 0 20px rgba(251, 191, 36, 0.5);

    /* Typography */
    --font-family: 'Outfit', sans-serif;

    /* Spacing */
    --tile-size: clamp(30px, 6vw, 65px);
    /* Increased max size */
    --tile-gap: clamp(2px, 0.5vw, 6px);
    /* Slightly reduced gap for tighter grid */
    --border-radius: 8px;
    /* Slightly sharper */
}

/* ===== Base Styles ===== */
html {
    background: var(--bg-dark);
    background-attachment: fixed;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.08) 0%, transparent 60%);
    color: var(--text-primary);
    margin: 0;
    padding: 40px 10px 80px 10px;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    align-items: center;
}

h1, h2, h3, .big-lobby-id, .mode-card h2 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0; /* Reduced spacing */
}

/* ===== Game Container ===== */
.game-container {
    width: 98%;
    max-width: 1600px;
    /* Increased to allow wider board */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    /* Reduced gap between elements */
}

/* ===== Header & New Logo ===== */
.game-header {
    width: 100%;
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0px;
}

.logo-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.6));
    animation: spin-slow 25s linear infinite;
}

@keyframes spin-slow {
    100% { transform: rotate(360deg); }
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 0.9;
}

.logo-word-1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 800;
    font-family: var(--font-display);
    background: linear-gradient(135deg, #00f2ff 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
    filter: drop-shadow(0 0 8px rgba(0, 242, 255, 0.5));
}

.logo-word-2 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 800;
    font-family: var(--font-display);
    background: linear-gradient(135deg, #ff00d4 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 3px;
    filter: drop-shadow(0 0 10px rgba(255, 0, 212, 0.6));
    margin-top: -2px;
}

.subtitle {
    color: var(--accent-gold);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 3px;
    text-shadow: 0 0 5px rgba(251, 191, 36, 0.4);
    margin-top: 8px;
    padding-left: 0;
}

/* ===== Screens ===== */
.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInStatic {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes blink-focus {
    0% {
        background-color: #fef3c7;
        box-shadow: 0 0 5px #fbbf24;
        border-color: #fbbf24;
    }

    50% {
        background-color: #fffbeb;
        box-shadow: 0 0 20px #fbbf24;
        border-color: #f59e0b;
    }

    100% {
        background-color: #fef3c7;
        box-shadow: 0 0 5px #fbbf24;
        border-color: #fbbf24;
    }
}

.input-blink {
    animation: blink-focus 0.8s infinite;
    border-width: 3px !important;
}

/* ===== Setup Layout ===== */
.setup-layout {
    display: flex;
    gap: 16px;
    width: 95%;
    max-width: 900px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin: 0 auto;
}

.setup-step {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px; /* Reduced padding for compactness */
}

.setup-step h2 {
    font-size: 1.8rem; /* Scaled down */
    font-weight: 800;
    margin-bottom: 25px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.mode-card {
    background: rgba(15, 0, 40, 0.6);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 28px;
    padding: 30px;
    flex: 1;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.mode-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-secondary);
    box-shadow: 0 30px 80px rgba(255, 0, 212, 0.2);
}

.mode-card h2 {
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.mode-card.special {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border: 2px solid var(--accent-pink);
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.2);
    position: relative;
    overflow: hidden;
}

.host-photo {
    width: 100%;
    max-width: 440px;
    height: auto;
    object-fit: contain;
    border-radius: 20px;
    border: 6px solid #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4), 
                0 0 0 6px rgba(0, 0, 0, 0.5), 
                0 25px 50px -12px rgba(0, 0, 0, 0.8);
    margin-bottom: 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #000;
}
.host-photo:hover {
    transform: scale(1.03) rotate(-2deg);
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.6), 
                0 0 0 6px rgba(0, 0, 0, 0.5), 
                0 30px 60px -12px rgba(0, 0, 0, 0.9);
    border-color: #fcd34d;
}

.mode-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 4px;
    margin-top: 8px;
}

.decoration-stars {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    animation: twinkle 2s infinite;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.divider {
    display: flex;
    align-items: center;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .setup-layout {
        flex-direction: column;
    }

    .divider {
        display: none;
    }
}

.mode-card h2 {
    font-size: 1.4rem;
    color: var(--accent-gold);
    margin-bottom: 10px;
}

.form-group {
    width: 100%;
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.form-group input {
    width: 100%;
    max-width: 400px;
    padding: 18px 25px;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    transition: all 0.3s ease;
    text-align: center;
    margin-bottom: 15px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.02);
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 18px 32px;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-secondary) 100%);
    border: none;
    border-radius: 50px; /* Modern pill shape */
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 10px 30px rgba(255, 0, 212, 0.5), inset 0 2px 5px rgba(255,255,255,0.4);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

#proceed-to-gift-btn {
    padding: 20px 40px;
    /* Increased padding */
    font-size: 1.3rem;
    margin-bottom: 40px;
    /* Add margin at bottom */
}

.btn-primary.pulse {
    animation: btnPulse 2s infinite;
}

@keyframes btnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 212, 0.6);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(255, 0, 212, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 212, 0);
    }
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 40px rgba(255, 0, 212, 0.6), inset 0 2px 5px rgba(255,255,255,0.5);
    filter: brightness(1.2);
}

.btn-primary:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 4px 15px rgba(219, 39, 119, 0.4);
}

.btn-secondary {
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-family);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
}

/* ===== Premium Big Lobby (Smartphone Mode) ===== */
.big-lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lobby-info-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    width: 100%;
}

.big-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 900px;
    justify-content: center;
    margin: 0 auto;
}

.lobby-player-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    animation: cardAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.lobby-player-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
    transform: translateY(-5px);
}

.player-avatar-circle {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.player-card-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}5);
    border-radius: 50px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-secondary:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-color: var(--accent-blue);
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

.btn-secondary:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 rgba(0,0,0,0.3);
}

.btn-guess {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-family);
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    border: none;
    border-radius: var(--border-radius);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-guess:hover {
    transform: scale(1.05);
    box-shadow: var(--glow-blue);
}

/* ===== Game Board ===== */
.board-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

/* Black oval with purple borders */
/* Oval removed as per request */
.board-oval {
    padding: 0; /* Removed extra wrapper padding */
}

.board-frame {
    /* Refined Magic Board Style */
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.1);
    padding: 6px; /* Elegant border thickness */
    position: relative;
    clip-path: polygon(7.14% 0%, 92.86% 0%,
            92.86% 25%, 100% 25%,
            100% 75%, 92.86% 75%,
            92.86% 100%, 7.14% 100%,
            7.14% 75%, 0% 75%,
            0% 25%, 7.14% 25%);
}

.game-board-inner {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e293b 100%);
    width: 100%;
    height: 100%;
    padding: 8px; /* Tighter internal padding */
    position: relative;
    overflow: hidden;
    clip-path: polygon(7.14% 0%, 92.86% 0%,
            92.86% 25%, 100% 25%,
            100% 75%, 92.86% 75%,
            92.86% 100%, 7.14% 100%,
            7.14% 75%, 0% 75%,
            0% 25%, 7.14% 25%);
    transition: background 1s ease;
}

.game-board-inner.express-active {
    background:
        /* Repeating dense glitter layers */
        radial-gradient(circle, #fff 1px, transparent 1.5px) 0 0 / 40px 40px,
        radial-gradient(circle, rgba(251, 191, 36, 0.4) 1px, transparent 2px) 20px 20px / 60px 60px,
        radial-gradient(circle, rgba(255, 255, 255, 0.3) 0.5px, transparent 1.5px) 10px 30px / 30px 30px,
        /* Bronzier antique gold gradient */
        linear-gradient(to right, #451a03 0%, #92400e 50%, #451a03 100%);
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.8);
    animation: goldGlimmer 2s infinite alternate ease-in-out;
}

@keyframes goldGlimmer {
    0% {
        filter: brightness(1) contrast(1);
    }

    100% {
        filter: brightness(1.1) contrast(1.1);
    }
}

.game-board-inner::before {
    /* Subtle metallic sheen inside the board */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.1) 50%, transparent 60%);
    pointer-events: none;
    animation: shine 5s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }

    100% {
        transform: translateX(100%) translateY(100%);
    }
}

/* New styles for header and intro text */
.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 0;
    /* Removed large padding to center content */
    position: relative;
    z-index: 10;
}


/* Intro Text Style */
.intro-text {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 25px;
    font-weight: 600;
}

.game-board {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Tight gap */
    position: relative;
    z-index: 1;
}

.board-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

/* ===== Tiles (Italian Style) ===== */
.tile {
    /* Larger vertical rectangles to fill the view */
    width: 58px; 
    height: 80px; 
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    font-family: var(--font-main);
    border-radius: 6px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #000;
    background: rgba(15, 23, 42, 0.5); 
    position: relative;
}

.tile.invisible {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}


/* Unrevealed letter tiles - SOLID WHITE */
.tile.letter {
    background: #ffffff; 
    border: 2px solid #000000;
    color: transparent;
}

/* Empty/background tiles - VISIBLE */
.tile.empty {
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid rgba(0, 242, 255, 0.5);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.9);
}

/* Revealed letter tiles - WHITE with BLACK TEXT */
.tile.letter.revealed {
    background: #fff;
    color: #000;
    border: 3px solid #000;
    animation: flipIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Express Mode: unrevealed tiles become transparent so gold board background shows through */
.express-active .tile.letter:not(.revealed) {
    background: transparent;
    border-color: rgba(251, 191, 36, 0.6);
    box-shadow: inset 0 0 8px rgba(251, 191, 36, 0.3);
}

.tile.letter.revealed::before {
    display: none;
}

@keyframes flipIn {
    0% {
        transform: perspective(400px) rotateY(90deg);
    }

    100% {
        transform: perspective(400px) rotateY(0deg);
    }
}

/* Removing unused glow/decorations to stay classic */
.tile.letter.revealed.just-revealed {
    animation: flipIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes glow {

    0%,
    100% {
        box-shadow: none;
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
}

/* ===== Controls ===== */
.controls-container {
    width: 100%;
    max-width: 1100px;
    /* Further increased width for solution visibility */
    padding: 20px 30px;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.guess-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.input-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.input-group input:not([type="checkbox"]) {
    flex: 1;
    /* Permette all'input di ridimensionarsi */
    min-width: 0;
}

#letter-input {
    width: 60px;
    /* Smaller input */
    height: 50px;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-family);
    text-align: center;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid var(--accent-blue);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

/* Solution Section */
.solution-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.solution-section label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-group.full-width {
    width: 100%;
}

#solution-input {
    flex-grow: 1;
    min-width: 200px;
    height: 50px;
    padding: 0 15px;
    font-size: 1rem;
    font-family: var(--font-family);
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--accent-purple);
    border-radius: var(--border-radius);
    color: var(--text-primary);
}

#solution-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: var(--glow-purple);
}

.btn-solve {
    padding: 0 20px;
    font-weight: 700;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--accent-pink), var(--accent-purple));
    border: none;
    border-radius: var(--border-radius);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-solve:hover {
    box-shadow: var(--glow-pink);
    transform: translateY(-2px);
}

.btn-pass {
    padding: 0 20px;
    font-weight: 700;
    text-transform: uppercase;
    background: linear-gradient(90deg, #6b7280, #374151);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-pass:hover {
    background: linear-gradient(90deg, #4b5563, #1f2937);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

#letter-input:focus {
    outline: none;
    box-shadow: var(--glow-blue);
    background: rgba(255, 255, 255, 0.15);
}

/* Hint Display */
.hint-display {
    padding: 10px 30px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(15, 23, 42, 0.6) 100%);
    border-radius: 12px;
    margin: 0 auto 15px auto;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(251, 191, 36, 0.2);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    width: fit-content;
}

.hint-label {
    font-size: 1rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1.5px;
}

#hint-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.btn-skip-phrase {
    justify-self: end;
    margin-right: 108px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: rgba(251, 191, 36, 0.75);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    padding: 7px 14px;
    border-radius: 20px;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-skip-phrase:hover {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.7);
    color: var(--accent-gold);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.2);
}

.used-letter.correct {
    background: var(--accent-green);
    color: white;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed; /* Fixed to cover whole viewport */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9); /* Opaque black background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Ensure it is on top of everything */
    transition: background-color 0.3s ease;
}

.modal-overlay.transparent {
    background: rgba(0, 0, 0, 0.1);
    align-items: flex-end;
    /* Move content to bottom */
    padding-bottom: 10px;
    /* Reduced padding to lower the modal */
}

/* Move popup higher when overlay is transparent (to avoid covering the letters) */
.modal-overlay.transparent .popup-message {
    bottom: 250px;
    /* High enough to clear the bottom modal */
    font-size: 1.5rem;
    /* Slightly smaller to be less intrusive */
    padding: 15px 30px;
}

.modal-overlay.transparent .modal-content {
    animation: slideUpBottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom center;
    max-width: 600px;
    /* Wider to show letters side-by-side if needed */
    padding: 15px;
    background: rgba(42, 42, 42, 0.95);
    /* Slightly transparent */
}

@keyframes slideUpBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 90%;
    width: 400px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rest of Selection Styles (reused) */
.selection-group {
    margin-bottom: 20px;
    text-align: left;
}

.selection-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.letters-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.letter-select {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.letter-select:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    outline: none;
    transform: translateY(-2px);
}

.letter-select.active-check {
    background: var(--accent-gold);
    color: var(--text-dark);
    border-color: white;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
    transform: scale(1.15);
}

/* ===== Message Display (Floating Toast) ===== */
.message-display {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px) scale(0.9);
    min-width: 320px;
    padding: 16px 40px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 800;
    text-align: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.message-display:not(:empty) {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Hide when empty */
.message-display:empty {
    transform: translateX(-50%) translateY(-20px);
}

.message-display.success {
    background: rgba(16, 185, 129, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

.message-display.error {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.message-display.info {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.error-message {
    color: var(--accent-red);
    font-size: 0.9rem;
    margin-bottom: 15px;
    height: 20px;
}

/* Popup Message */
.popup-message {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    padding: 30px 50px;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 20px;
    border: 3px solid var(--accent-gold);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(251, 191, 36, 0.2);
    animation: fadeInStatic 0.3s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;

    /* Position at center */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 650px;
    /* prevent horizontal scrollbar from wide children */
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 90vh;
}

.popup-message.transparent-wrapper {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important; /* Allow it to be wide */
    width: 100% !important;
    height: auto !important;
}

/* ===== Popup Variants ===== */
.popup-message.danger {
    border-color: #ef4444;
    box-shadow: 0 0 50px rgba(0,0,0,0.8), 0 0 30px rgba(239,68,68,0.35);
    animation: popupShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

.popup-message.warning {
    border-color: #f59e0b;
    box-shadow: 0 0 50px rgba(0,0,0,0.8), 0 0 20px rgba(245,158,11,0.3);
}

.popup-message.special {
    border-color: #a78bfa;
    box-shadow: 0 0 50px rgba(0,0,0,0.8), 0 0 30px rgba(167,139,250,0.35);
}

.popup-message.subtle-success {
    border-color: #34d399;
    box-shadow: 0 0 50px rgba(0,0,0,0.8), 0 0 20px rgba(52,211,153,0.3);
}

.popup-message.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #34d399;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.6);
}

/* ===== Popup Inner Structure ===== */
.popup-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.popup-icon {
    font-size: 3rem;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.popup-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1.1;
}

.popup-text {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.75;
    line-height: 1.5;
}

.popup-message.center-screen {
    position: fixed;
    /* Ensure fixed positioning relative to viewport */
    top: 35%;
    /* Moved higher up from 50% */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    /* Responsive width */
    max-width: 600px;
    height: auto;

    display: flex;
    /* Flex centering for content */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;

    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.2;

    padding: 40px;
    background: rgba(15, 23, 42, 0.98);
    /* Darker, more opaque background */
    border: 3px solid var(--accent-gold);
    border-radius: 20px;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8), 0 0 30px rgba(251, 191, 36, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white; /* Changed to white for better contrast */
    font-weight: 800;
    border: none;
    padding: 18px 45px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 242, 255, 0.5);
}

.btn-secondary {
    background: rgba(157, 78, 221, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 242, 255, 0.3);
    padding: 12px 24px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(157, 78, 221, 0.2);
    border-color: var(--accent-secondary);
}
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    /* Dark overlay */
    backdrop-filter: blur(5px);
    z-index: 2999;
    display: none;
    /* Controlled by JS */
    justify-content: center;
    align-items: center;
}

@keyframes popCenter {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.popup-message.error {
    background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
    border: 3px solid #ef4444;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.4);
    animation: popupShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes popupShake {
    10%, 90% { transform: translate3d(-51%, -50%, 0); }
    20%, 80% { transform: translate3d(-48%, -50%, 0); }
    30%, 50%, 70% { transform: translate3d(-52%, -50%, 0); }
    40%, 60% { transform: translate3d(-48%, -50%, 0); }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Win Screen Updates */
/* ===== Win Screen ===== */
.win-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    backdrop-filter: blur(20px);
    border: 3px solid var(--accent-gold);
    border-radius: 30px;
    padding: 20px 30px;
    text-align: center;
    max-width: 900px;
    width: 90%;
    max-height: 96vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(251, 191, 36, 0.3), inset 0 0 30px rgba(255, 255, 255, 0.05);
    animation: winEntrance 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

@keyframes winEntrance {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes winPulse {

    0%,
    100% {
        box-shadow: var(--glow-gold);
    }

    50% {
        box-shadow: 0 0 40px rgba(251, 191, 36, 0.8);
    }
}

.confetti {
    font-size: 2.2rem;
    margin-bottom: 6px;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.win-card h2 {
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
    line-height: 1.2;
}

/* Specific style for final message if needed, but H2 modification covers it. 
   The image container also needs update. */
.final-image-container {
    margin: 30px 0;
    /* More spacing */
    padding: 15px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: rotate(-2deg);
    animation: float 6s ease-in-out infinite;
    width: 100%;
    max-width: 600px;
    /* Allowed larger image */
}

#final-image {
    width: 100%;
    max-width: none;
    /* Removed limitation inside container */
    border-radius: 2px;
    display: block;
    height: auto;
}

.final-caption {
    color: #333;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    margin-top: 15px;
    font-size: 1.5rem;
    /* Larger caption */
}

.win-phrase {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.win-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.win-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.win-stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-blue);
}

.win-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .game-container {
        padding: 10px;
    }

    .setup-card,
    .controls-container {
        padding: 20px;
    }

    .board-frame {
        padding: 12px;
        border-width: 5px;
    }

    .stats-section {
        gap: 15px;
    }

    .win-card {
        padding: 30px 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }
}

/* ===== Welcome Screen ===== */
.welcome-image-container {
    margin: 20px 0;
    width: 100%;
    max-width: 700px;
    /* Enlarge image */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 4px solid white;
    margin-left: auto;
    margin-right: auto;
}

#welcome-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

#welcome-image:hover {
    transform: scale(1.02);
}

/* ===== Game Mode Adjustments ===== */
/* When .game-mode class is added to game-container */
.game-container.game-mode .game-header {
    margin-top: 40px;
    /* Add space specifically for game mode */
    margin-bottom: 20px;
}

.game-container.game-mode {
    justify-content: flex-start;
    /* Prevent centering form pushing top off-screen */
    padding-top: 20px;
}

/* ===== Reveal HUD (New) ===== */
.reveal-hud {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid var(--accent-gold);
    border-radius: 20px;
    padding: 20px 40px;
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    animation: slideUp 0.5s ease-out;
}

.reveal-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.reveal-letters-container {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Removed duplicate .tile definition to fix shape/size issues */

.tile.hidden {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.tile.revealed {
    background: #fff;
    color: var(--bg-dark);
    border-color: var(--accent-primary);
    box-shadow: 0 0 25px var(--accent-primary), 0 0 50px rgba(0, 242, 255, 0.3);
    transform: scale(1.05);
}

.tile.newly-revealed {
    animation: revealPulse 0.6s ease-out;
}

@keyframes revealPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(0, 242, 255, 0); }
    50% { transform: scale(1.15); box-shadow: 0 0 40px var(--accent-primary); }
    100% { transform: scale(1.05); box-shadow: 0 0 25px var(--accent-primary); }
}

.reveal-tile.active {
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    transform: scale(1.1);
}

.reveal-tile.success {
    background: var(--accent-green);
    border-color: #34d399;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    transform: scale(1.1);
}

.reveal-tile.error {
    background: var(--accent-red);
    border-color: #f87171;
    opacity: 0.6;
    transform: scale(0.9);
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 50px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Remaining Letters Counter */
#remaining-letters {
    font-weight: 800;
    color: var(--accent-red);
    font-size: 1.1rem;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* ===== Multiplayer Setup ===== */
.player-count-selector {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.count-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.count-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-pink);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.player-name-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 6px;
}

/* Checkbox Style */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 1rem;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 24px;
    width: 24px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s;
}

.checkbox-container:hover input~.checkmark {
    background-color: rgba(255, 255, 255, 0.2);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 8px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Turn Indicator */
.turn-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3));
    padding: 15px 25px;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.turn-label {
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.current-player-badge {
    font-weight: 800;
    color: #fff;
    background: linear-gradient(90deg, var(--accent-gold), #f59e0b);
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 1.3rem;
    text-transform: uppercase;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
    }

    50% {
        box-shadow: 0 0 25px rgba(251, 191, 36, 0.7);
    }
}

/* 2-Step Setup */
.setup-step {
    width: 100%;
}

.player-count-input {
    width: 80px;
    padding: 12px;
    font-size: 1.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--accent-purple);
    border-radius: 8px;
    color: white;
    margin: 10px 0;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* ===== New Game Layout ===== */

/* ===== Manche Indicator & Game Top Bar ===== */
.game-top-bar {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 10px;
}

.compact-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    opacity: 0.8;
}

.logo-icon-small {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.4));
    animation: spin-slow 25s linear infinite;
}

.logo-text-small {
    font-size: 1rem;
    font-weight: 800;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cw1 {
    background: linear-gradient(135deg, #00f2ff 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cw2 {
    background: linear-gradient(135deg, #ff00d4 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.manche-indicator {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    justify-self: center;
}

.manche-number {
    font-size: 1.2rem;
    color: var(--accent-gold);
}

/* Main Game Layout */
/* Main Game Layout */
.game-main-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    gap: clamp(20px, 4vw, 60px); 
    padding: 0 20px;
}

.players-sidebar,
.wheel-value-sidebar {
    flex: 0 0 220px;
    width: 220px;
    position: relative;
    z-index: 10;
}

.board-area {
    flex: 1;
    max-width: 850px; /* Increased to occupy more space */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.board-frame {
    max-width: 100%; /* Scale down if needed */
}

.spin-container-centered {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: 0px;
}

/* Players Sidebar — LEFT — MANCHE ATTUALE (cyan accent) */
.players-sidebar {
    background: rgba(0, 18, 40, 0.75);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(0, 242, 255, 0.07);
}

.players-sidebar h3,
.sidebar-title {
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 2.5px;
    color: var(--accent-primary);
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    padding-bottom: 10px;
    text-transform: uppercase;
}

.players-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.players-list li {
    padding: 7px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    transition: all 0.3s ease;
}

.players-list li.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border: 2px solid var(--accent-gold);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
    transform: scale(1.05);
}

.player-avatar-wrap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    flex-shrink: 0;
    border: 2px solid transparent;
    position: relative;
}

.players-list li.active .player-avatar-wrap {
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.player-shield-badge {
    position: absolute;
    bottom: -6px;
    right: -8px;
    font-size: 1.1rem;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.9));
    animation: shieldPulse 1.5s ease-in-out infinite;
    background: rgba(10, 20, 40, 0.75);
    border-radius: 50%;
    padding: 2px;
}

.player-info-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}

.player-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-score {
    font-size: 0.95rem;
    color: var(--accent-gold);
    font-weight: 800;
}

/* Board Area */
.board-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Wheel Value Sidebar — RIGHT — TOTALI GARA (gold accent) */
.wheel-value-sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: rgba(30, 18, 0, 0.75);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(251, 191, 36, 0.07);
}

/* Total Winnings Sidebar Box */
.total-winnings-card {
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    background: transparent;
    border-radius: 0;
    padding: 0;
    text-align: center;
    border: none;
    min-width: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.total-winnings-card .value-label {
    font-size: 0.7rem;
    letter-spacing: 2.5px;
    color: var(--accent-gold);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
    padding-bottom: 10px;
    margin-bottom: 5px;
    display: block;
}

.wheel-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.win-card h2 {
    font-size: 2.4rem;
    font-weight: 900;
    margin-bottom: 10px;
    background: linear-gradient(to bottom, #fff, var(--accent-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: -1px;
}

/* Podio Risultati */
.win-title-name {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 30px rgba(251,191,36,0.6);
    display: block;
}

.win-title-sub {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    letter-spacing: 4px;
    text-transform: uppercase;
    display: block;
}

.results-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    margin: 10px 0 8px;
    width: 100%;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    max-width: 180px;
    border-radius: 14px 14px 0 0;
    padding: 10px 8px 0;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.podium-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    margin-top: auto;
}

.podium-place:hover { transform: translateY(-5px); }

.podium-place.first {
    background: linear-gradient(180deg, rgba(251,191,36,0.18), rgba(251,191,36,0.04));
    border-color: rgba(251,191,36,0.5);
    box-shadow: 0 0 30px rgba(251,191,36,0.2);
    order: 2;
    padding-bottom: 0;
}
.podium-place.first .podium-bar { height: 44px; background: rgba(251,191,36,0.35); }

.podium-place.second {
    background: rgba(255,255,255,0.04);
    border-color: rgba(203,213,225,0.3);
    order: 1;
    padding-bottom: 0;
}
.podium-place.second .podium-bar { height: 28px; background: rgba(203,213,225,0.2); }

.podium-place.third {
    background: rgba(255,255,255,0.03);
    border-color: rgba(146,64,14,0.3);
    order: 3;
    padding-bottom: 0;
}
.podium-place.third .podium-bar { height: 16px; background: rgba(146,64,14,0.25); }

.place-icon {
    font-size: 1.5rem;
    line-height: 1;
    animation: podiumBounce 1.5s ease-in-out infinite;
}

.podium-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    background: white;
    padding: 2px;
}

.podium-place.first .podium-avatar {
    width: 58px;
    height: 58px;
    border-color: rgba(251,191,36,0.6);
    box-shadow: 0 0 14px rgba(251,191,36,0.4);
    background: white;
    padding: 2px;
}

@keyframes podiumBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.podium-place.second .place-icon,
.podium-place.third .place-icon { animation: none; }

.place-name {
    font-weight: 800;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.place-score {
    font-weight: 900;
    color: var(--accent-gold);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.win-message {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(251,191,36,0.5);
    margin: 8px 0 14px;
    letter-spacing: 1px;
}

.results-list-remaining {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
}

.result-row-small {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 6px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.wheel-value.crollo {
    color: var(--accent-red);
    font-size: 1rem;
}

.wheel-value.passa {
    color: var(--text-secondary);
    font-size: 1.2rem;
}




.total-winnings-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.total-winnings-list li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.82rem;
    overflow: hidden;
}

.total-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: white;
    object-fit: cover;
    flex-shrink: 0;
}

.total-winnings-list .win-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.total-winnings-list .win-amount {
    font-weight: 800;
    color: var(--accent-gold);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Game Actions Row - New side-by-side structure */
.game-actions-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    margin: 30px auto;
    flex-wrap: wrap;
    /* Aggiunto per mobile */
}

.letters-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centra gli elementi orizzontalmente */
    text-align: center;
    /* Centra il testo delle label */
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 18px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 0 1 360px;
    max-width: 360px;
}

.letters-controls .input-group {
    justify-content: center;
    /* Centra input e bottone */
    width: 100%;
}

.letters-controls .input-group input {
    width: 60px !important;
    /* Forza larghezza piccola per lettere */
    flex: 0 0 60px !important;
}

.letters-controls .btn-action {
    padding: 10px 15px;
    /* Pulsanti più compatti */
    font-size: 0.85rem;
}

.solve-section-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.input-group.full-width {
    width: 100%;
    max-width: 800px;
    /* Much wider */
    display: flex;
    gap: 10px;
}

.input-group.full-width input {
    flex: 1;
    font-size: 1.2rem;
    padding: 12px;
    text-align: center;
}

.btn-solve {
    padding: 12px 30px;
    font-size: 1.1rem;
    white-space: nowrap;
}

/* Hide old selectors if present or override */
.game-bottom-layout {
    display: none;
    /* Deprecated in favor of bottom-interaction-container logic */
}

/* Wheel Area */
.wheel-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.wheel-container {
    position: relative;
    width: 250px;
    height: 250px;
}

#wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid var(--accent-gold);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    margin-left: -20px;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 50px solid #fbbf24;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    z-index: 10;
}

.wheel-pointer::after {
    content: '';
    position: absolute;
    top: -48px;
    left: -14px;
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 35px solid var(--accent-secondary);
}

.btn-spin {
    padding: 22px 50px;
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.6), inset 0 2px 5px rgba(255,255,255,0.4);
    text-transform: uppercase;
    animation: spinPulse 2s infinite ease-in-out;
}

@keyframes spinPulse {
    0%, 100% {
        box-shadow: 0 8px 0 #581c87, 0 12px 30px rgba(168, 85, 247, 0.5);
    }
    50% {
        box-shadow: 0 8px 0 #581c87, 0 20px 45px rgba(168, 85, 247, 0.7), 0 0 30px rgba(255, 0, 212, 0.5);
    }
}

.btn-spin:hover:not(:disabled) {
    transform: translateY(2px) scale(1.02);
    box-shadow: 0 6px 0 #581c87, 0 10px 20px rgba(168, 85, 247, 0.6);
    background: linear-gradient(135deg, var(--accent-tertiary), #d946ef);
}

.btn-spin:active:not(:disabled) {
    transform: translateY(8px);
    box-shadow: 0 0 0 #7b2cbf, 0 4px 10px rgba(255, 0, 212, 0.2);
}

.btn-spin:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
    transform: translateY(8px);
    box-shadow: none;
}
    box-shadow: 0 0 0 #b45309;
}

/* Action Controls */
.action-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 400px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.control-group .input-group {
    display: flex;
    gap: 10px;
}

.control-group input {
    flex: 1;
    padding: 14px 15px;
    font-size: 1.1rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--accent-gold);
    text-transform: uppercase;
    text-align: center;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
}

.control-group input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.5), 0 0 15px rgba(251, 191, 36, 0.4);
    background: rgba(0, 0, 0, 0.6);
}

.control-group input:disabled {
    opacity: 0.4;
    box-shadow: none;
}

.btn-action {
    padding: 12px 28px;
    font-weight: 800;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--accent-primary), #0284c7);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.4), inset 0 2px 4px rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 255, 0.6), inset 0 2px 4px rgba(255,255,255,0.4);
    filter: brightness(1.1);
}

.btn-action:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0 0 #0369a1;
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(4px);
    box-shadow: 0 0 0 #0369a1;
}

.btn-vowel {
    background: linear-gradient(180deg, var(--accent-pink) 0%, #be185d 100%);
    box-shadow: 0 4px 0 #831843, 0 6px 12px rgba(0,0,0,0.3);
}

.btn-vowel:hover:not(:disabled) {
    background: linear-gradient(180deg, #f472b6 0%, #be185d 100%);
    box-shadow: 0 2px 0 #831843, 0 4px 8px rgba(0,0,0,0.3);
}

.btn-vowel:active:not(:disabled) {
    box-shadow: 0 0 0 #831843;
}

.btn-solve {
    padding: 14px 24px;
    font-weight: 900;
    font-size: 1.1rem;
    background: linear-gradient(180deg, #10b981 0%, #047857 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 5px 0 #064e3b, 0 8px 16px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.btn-solve:hover {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #064e3b, 0 5px 10px rgba(0,0,0,0.3);
    background: linear-gradient(180deg, #34d399 0%, #047857 100%);
}
.btn-solve:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 #064e3b;
}

.btn-pass {
    padding: 14px 24px;
    font-weight: 800;
    font-size: 1rem;
    background: linear-gradient(180deg, #64748b 0%, #334155 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 0 #1e293b, 0 6px 12px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.btn-pass:hover {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1e293b, 0 4px 8px rgba(0,0,0,0.3);
}
.btn-pass:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #1e293b;
}

/* Game Footer */
.game-footer {
    margin-top: 15px;
}

/* Responsive */
@media (max-width: 1100px) {

    .players-sidebar,
    .wheel-value-sidebar {
        flex: 0 0 160px;
        /* Slimmer sidebars */
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* ===== MOBILE LANDSCAPE — 2-column layout via JS ===== */

#game-screen.ml-active {
    display: grid;
    grid-template-columns: 62% 38%;
    grid-template-rows: auto 1fr;
    height: 100dvh;
    overflow: hidden;
    box-sizing: border-box;
}

#game-screen.ml-active .game-top-bar {
    grid-column: 1 / 3;
    grid-row: 1;
    margin-bottom: 0;
    padding: 3px 10px;
}
#game-screen.ml-active .compact-logo { display: none; }
#game-screen.ml-active .manche-indicator { font-size: 0.82rem; }
#game-screen.ml-active .skip-phrase-btn { font-size: 0.68rem; padding: 3px 10px; }

/* Left panel: category + board */
#ml-left {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    overflow: hidden;
    gap: 6px;
}

#ml-left .hint-display {
    font-size: 0.75rem;
    padding: 3px 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: center;
    gap: 6px;
}

#ml-left .board-container { padding: 0 6px; width: 100%; box-sizing: border-box; }
#ml-left .board-frame { padding: 4px; }
#ml-left .game-board-inner { padding: 4px; overflow: hidden; }
#ml-left .tile.invisible { display: none; }

#ml-left .tile {
    /* clamp: fits 14 tiles in 62vw minus paddings/gaps */
    width: clamp(22px, calc((62vw - 80px) / 14), 40px);
    height: clamp(30px, calc((62vw - 80px) / 14 * 1.5), 60px);
    font-size: clamp(0.6rem, 2.5vw, 1.2rem);
    border-radius: 4px;
}
#ml-left .board-row { gap: 3px; }
#ml-left .game-board { gap: 4px; }

/* Right panel: scores + action + controls */
#ml-right {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Scores: 2 sidebar affiancate */
#ml-scores {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
#ml-scores .players-sidebar,
#ml-scores .wheel-value-sidebar {
    flex: 1 1 120px;
    min-width: 0;
    padding: 5px 7px;
    font-size: 0.68rem;
    border-radius: 8px;
    position: static;
}
#ml-scores .sidebar-title,
#ml-scores .value-label { font-size: 0.58rem; margin-bottom: 2px; }

/* MANCHE ATTUALE — uniforma dimensioni */
#ml-scores .players-list { gap: 4px; }
#ml-scores .players-list li { padding: 4px 6px; gap: 5px; border-radius: 7px; }
#ml-scores .player-avatar-wrap,
#ml-scores .player-avatar { width: 22px; height: 22px; }
#ml-scores .player-name { font-size: 0.68rem; }
#ml-scores .player-score { font-size: 0.7rem; }

/* TOTALI GARA — uniforma a stessa struttura */
#ml-scores .total-winnings-list { gap: 4px; }
#ml-scores .total-winnings-list li { padding: 4px 6px; gap: 5px; border-radius: 7px; font-size: 0.68rem; }
#ml-scores .total-avatar { width: 22px; height: 22px; }
#ml-scores .win-name { font-size: 0.68rem; font-weight: 700; }
#ml-scores .win-amount { font-size: 0.7rem; }

/* Central action: prominent */
#ml-right .central-action-area {
    flex-shrink: 0;
    min-height: 0;
    margin-top: 0;
    padding: 6px 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
#ml-right .btn-spin {
    padding: 10px 20px;
    font-size: 0.95rem;
    border-radius: 40px;
    max-width: 100%;
}

/* Game actions: vocale + soluzione */
#ml-right .game-actions-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}
#ml-right .letters-controls,
#ml-right .solve-section-card {
    padding: 6px 10px;
    border-radius: 8px;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    flex: none;
    gap: 4px;
    overflow: hidden;
}
#ml-right .letters-controls label,
#ml-right .solve-section-card label {
    font-size: 0.65rem;
    white-space: normal;
    word-break: break-word;
    text-align: center;
}
#ml-right .letters-controls input,
#ml-right .solve-section-card input {
    height: 30px;
    font-size: 0.82rem;
}
#ml-right .btn-action, #ml-right .btn-solve, #ml-right .btn-pass {
    height: 30px;
    padding: 0 12px;
    font-size: 0.78rem;
}

@media (max-width: 1024px) and (orientation: portrait) {
    .game-main-layout {
        flex-wrap: wrap;
        justify-content: center;
    }

    .players-sidebar,
    .wheel-value-sidebar {
        flex: 1 1 45%;
        order: 2;
        margin-top: 20px;
        max-width: none;
    }

    .board-area {
        order: 1;
        width: 100%;
        flex: 0 0 100%;
    }

    .wheel-value-sidebar {
        position: static;
    }

    .game-bottom-layout {
        grid-template-columns: 1fr;
    }

    .wheel-container {
        width: 280px;
        height: 280px;
    }
}

/* ===== Popup Content Centering & Focus ===== */
.popup-error {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border: 3px solid #f87171;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.6);
    animation: shakeError 0.5s ease-in-out;
}

.popup-error-large {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
    padding: 30px 20px;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    gap: 15px;
    margin: 0;
}

.popup-error-large>* {
    width: 100%;
    text-align: center;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.popup-letter-wrong {
    font-size: 96px;
    font-weight: 900;
    color: #9ca3af;
    display: inline-block;
    text-shadow: 0 0 20px rgba(156, 163, 175, 0.5);
    letter-spacing: 8px;
    margin: 20px 0;
    word-break: keep-all;
}

.popup-error-letter {
    width: 100%;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffffff;
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
    padding: 40px 30px;
    box-sizing: border-box;
    gap: 20px;
    margin: 0;
    overflow: hidden;
}

.popup-error-letter>* {
    width: 100%;
    text-align: center;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.popup-letter-wrong-small {
    font-size: 80px;
    font-weight: 900;
    color: #9ca3af;
    display: block;
    text-align: center;
    text-shadow: 0 0 20px rgba(156, 163, 175, 0.5);
    letter-spacing: 8px;
    margin: 10px auto;
    word-break: keep-all;
    width: 100%;
}

.popup-turn-info {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    margin-top: 10px;
    text-transform: none;
    text-align: center;
    width: 100%;
}

.popup-raddoppia {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 15px;
    padding: 30px;
    box-sizing: border-box;
}

.popup-raddoppia>* {
    width: 100%;
    text-align: center;
}

.popup-raddoppia-title {
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 40px rgba(251, 191, 36, 0.8), 0 4px 20px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
}

.popup-raddoppia-text {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

.popup-raddoppia-highlight {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 50px rgba(251, 191, 36, 1), 0 4px 20px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.popup-raddoppia-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent-blue);
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.6), 0 4px 10px rgba(0, 0, 0, 0.8);
}

.popup-raddoppia-action {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
    margin-top: 10px;
}

@keyframes shakeError {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.popup-turn,
.popup-win,
.popup-loading,
.popup-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.popup-turn-player {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.popup-name {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.popup-info {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-blue);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    text-transform: uppercase;
}

.popup-name {
    display: block;
    margin-top: 15px;
    font-size: 5rem;
    /* Huge font for name */
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 40px rgba(251, 191, 36, 0.8);
    animation: pulseName 2s infinite ease-in-out;
    line-height: 1.1;
}

@keyframes pulseName {

    0%,
    100% {
        transform: scale(1);
        text-shadow: 0 0 40px rgba(251, 191, 36, 0.8);
    }

    50% {
        transform: scale(1.05);
        text-shadow: 0 0 60px rgba(251, 191, 36, 1);
    }
}

/* Ensure error popups are also centered and nice */
.popup-message.error .popup-name {
    color: #fff;
    /* White name on red error background */
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* ===== Wheel Full Screen Overlay ===== */
.wheel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    /* Top level */
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wheel-overlay.active {
    display: flex;
    opacity: 1;
}

/* Scale up the wheel significantly in the overlay */
.wheel-overlay .wheel-container {
    width: 80vmin;
    height: 80vmin;
    transform: none;
    border-radius: 50%;
    /* Ensure container is round */
    overflow: visible;
    /* Allow pointer/shadows to extend */
    box-shadow: 0 0 150px rgba(251, 191, 36, 0.3);
    /* Enhanced golden ambient glow */
}

.wheel-overlay .wheel-pointer {
    font-size: 6rem;
    top: -40px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

@media (max-width: 768px) {
    .wheel-overlay .wheel-container {
        transform: scale(1.0);
        /* Normal scale on mobile */
    }
}

/* ===== Mystery Segment Choice Popup ===== */
.popup-mystery {
    padding: 20px;
}

.popup-choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 25px 0;
    align-items: center;
}

.btn-mystery-take {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    /* Green */
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-mystery-raffle {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    /* Gold */
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-mystery-take:hover,
.btn-mystery-raffle:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.choice-divider {
    font-weight: 800;
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    width: 100%;
}

.choice-divider::before,
.choice-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.choice-divider::before {
    left: 0;
}

.choice-divider::after {
    right: 0;
}

.choice-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.popup-mystery-result .popup-value {
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent-gold);
    display: block;
    margin-top: 10px;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

/* ===== EXPRESS MODE POPUP ===== */
.popup-express {
    background: linear-gradient(135deg, #1e1b4b 0%, #0c0a09 100%);
    border: 4px solid #facc15;
    border-radius: 30px;
    padding: 40px;
    color: white;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(250, 204, 21, 0.3);
    text-align: center;
    max-width: 550px;
    position: relative;
    overflow: hidden;
}

.popup-express::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.popup-express-title {
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 25px;
    color: #facc15;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 15px rgba(250, 204, 21, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.popup-express-title .rocket {
    font-size: 3.5rem;
    animation: launch 1s infinite alternate cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes launch {
    from {
        transform: translateY(0) scale(1.1);
    }

    to {
        transform: translateY(-10px) scale(1.2);
    }
}

.popup-express-body {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.popup-express-body b {
    color: #facc15;
    font-size: 1.4rem;
}

.popup-express-body .warning {
    display: block;
    margin-top: 20px;
    background: rgba(239, 68, 68, 0.2);
    padding: 10px 20px;
    border-radius: 12px;
    color: #f87171;
    font-weight: 800;
    border: 1px solid rgba(239, 68, 68, 0.3);
    text-transform: uppercase;
    animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(239, 68, 68, 0.4);
    }
}

.express-benefit-list {
    text-align: left;
    display: inline-block;
    margin: 20px 0;
}

.express-benefit-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    font-weight: 600;
}

.express-benefit-icon {
    width: 32px;
    height: 32px;
    background: #facc15;
    color: #1e1b4b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    flex-shrink: 0;
}

/* ===== Central Action Area (Spin / Consonant) ===== */
.central-action-area {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    /* Preserve space */
    margin-top: 20px;
}

#pass-btn-center {
    padding: 20px 45px;
    font-size: 1.4rem;
    font-weight: 900;
    background: linear-gradient(90deg, #6b7280, #374151);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#pass-btn-center:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
    background: linear-gradient(90deg, #4b5563, #1f2937);
}

#pass-btn-center:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.consonant-call-container {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    border-radius: 50px;
    border: 2px solid var(--accent-blue);
    animation: fadeIn 0.3s ease;
}

.value-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 20px;
}

.value-label-small {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.value-amount {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-gold);
}

.consonant-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.consonant-input-wrapper input {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    text-align: center;
    border-radius: 10px;
    border: 2px solid var(--accent-blue);
    background: #fff;
    color: #000;
    font-weight: bold;
}

.consonant-input-wrapper input:focus {
    outline: none;
    box-shadow: 0 0 10px var(--accent-blue);
}

/* ===== Minimal Mystery Popup ===== */
.popup-mystery-minimal {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    padding: 10px 0;
}

.mystery-cards-container {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
}

.mystery-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.mystery-note {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 20px;
}

.mystery-card {
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    pointer-events: auto !important;
}

.mystery-card:active {
    transform: scale(0.95);
}

.mystery-card:hover {
    transform: translateY(-10px) scale(1.05);
    border-color: #fff;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
}

.mystery-card.left {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.4) 100%);
    border-color: var(--accent-green);
}

.mystery-card.left:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.6);
}

.mystery-card.right {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(217, 119, 6, 0.4) 100%);
    border-color: var(--accent-gold);
}

.mystery-card.right:hover {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
    pointer-events: none;
    /* Click on parent */
}

.card-icon {
    font-size: 4rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.card-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
    text-transform: uppercase;
}

/* ===== Jolly Choice Popup ===== */
.popup-megaturno-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.megaturno-choice-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
}

.megaturno-choice-text {
    font-size: 1.2rem;
    color: #fff;
    text-align: center;
    line-height: 1.5;
}

/* ===== New Wheel Value States ===== */
.wheel-value.raddoppia {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
    animation: pulseRaddoppia 1s infinite;
}

.wheel-value.megaturno {
    background: linear-gradient(135deg, #ff00d4, #7C3AED);
    color: #fbbf24;
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    border: 2px solid #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5), 0 0 40px rgba(255, 0, 212, 0.3);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
    animation: pulseMegaturno 1s ease-in-out infinite alternate;
}

@keyframes pulseMegaturno {
    from { box-shadow: 0 0 15px rgba(251, 191, 36, 0.4), 0 0 30px rgba(255, 0, 212, 0.2); }
    to   { box-shadow: 0 0 30px rgba(251, 191, 36, 0.8), 0 0 60px rgba(255, 0, 212, 0.5); }
}

.wheel-value.crollo {
    background: #000;
    color: #fff;
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    border: 2px solid #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* ===== New Popup Styles ===== */
.popup-manche-start {
    text-align: center;
    padding: 35px 50px;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    border: 3px solid #fbbf24;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(251, 191, 36, 0.2);
    width: 80%;
    max-width: 750px; /* Wide horizontal layout */
    box-sizing: border-box;
    margin: 0 auto;
    animation: popMancheCenter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Tighter gap for better hierarchy */
}

.popup-manche-start>* {
    width: 100%;
    text-align: center;
}

.popup-manche-number {
    font-size: 0.9rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.popup-manche-hint {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.popup-category-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 2px;
}

.popup-manche-hint-large {
    font-size: clamp(1.5rem, 8vw, 2.4rem); /* Dynamic font size to ensure it fits */
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
    line-height: 1.1;
    white-space: nowrap; /* Prevent word break */
    margin-bottom: 12px;
}



@keyframes popMancheCenter {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulseManche {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* old inner popup classes removed — border/shadow now on outer .popup-message variant */

/* ===== Shield Icon Pulsing Animation ===== */
.shield-icon {
    display: inline-block;
    animation: shieldPulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 5px rgba(147, 51, 234, 0.8));
}

@keyframes shieldPulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(147, 51, 234, 0.8));
    }

    50% {
        transform: scale(1.2);
        filter: drop-shadow(0 0 15px rgba(147, 51, 234, 1));
    }
}

/* ===== Custom Mode Selection ===== */
.mode-selection-container {
    display: flex;
    justify-content: center;
    gap: 32px;
    width: 100%;
    max-width: 820px;
    margin: 24px auto 0;
    flex-direction: row;
    flex-wrap: wrap;
}

.mode-option-card {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 32px;
    padding: 50px 40px 40px;
    width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

/* Decorative top glow bar */
.mode-option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    border-radius: 0 0 4px 4px;
    background: var(--card-accent, rgba(139,92,246,0.6));
    box-shadow: 0 0 20px var(--card-accent, rgba(139,92,246,0.4));
    transition: width 0.35s ease;
}

.mode-option-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% -10%, var(--card-accent-soft, rgba(139,92,246,0.07)) 0%, transparent 65%);
    pointer-events: none;
    transition: opacity 0.35s ease;
    opacity: 0;
}

.mode-option-card:hover::after {
    opacity: 1;
}

.mode-option-card:hover::before {
    width: 80%;
}

/* Local mode — purple accent */
#mode-local-btn {
    --card-accent: rgba(139, 92, 246, 0.7);
    --card-accent-soft: rgba(139, 92, 246, 0.12);
    --card-glow: rgba(139, 92, 246, 0.35);
}

/* Smartphone mode — blue accent */
#mode-smartphone-btn {
    --card-accent: rgba(0, 212, 255, 0.7);
    --card-accent-soft: rgba(0, 212, 255, 0.12);
    --card-glow: rgba(0, 212, 255, 0.35);
}

.mode-option-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--card-accent, rgba(139,92,246,0.5));
    box-shadow: 0 20px 50px var(--card-glow, rgba(139,92,246,0.3)),
                0 0 0 1px rgba(255,255,255,0.06);
    background: rgba(255, 255, 255, 0.07);
}

.mode-option-card:active {
    transform: translateY(-5px) scale(0.99);
}

.mode-icon-wrapper {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 2px 10px rgba(255,255,255,0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Fix for Windows: ensure content-box alignment */
    flex-shrink: 0;
    overflow: hidden;
    line-height: 1;
}

.mode-emoji {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 15px var(--card-glow, rgba(255,255,255,0.3)));
    transition: transform 0.4s ease;
}

.mode-option-card:hover .mode-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--card-accent, rgba(255,255,255,0.3));
    box-shadow: 0 15px 40px var(--card-glow, rgba(255,255,255,0.2));
}

.mode-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-gold);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
}

.mode-desc {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
    max-width: 260px;
}

/* Secondary card styling (for Beta/experimental features) */
.mode-option-card.secondary {
    transform: scale(0.85);
    opacity: 0.7;
    filter: grayscale(30%);
}

.mode-option-card.secondary:hover {
    transform: scale(0.9) translateY(-5px);
    opacity: 1;
    filter: grayscale(0%);
}

/* Beta badge on smartphone card */
#mode-smartphone-btn .mode-badge.beta {
    position: absolute;
    top: -1px;
    right: 20px;
    background: linear-gradient(90deg, #475569, #334155);
    color: rgba(255,255,255,0.7);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 0 0 8px 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ===== Big Lobby View (Smartphone Mode) ===== */
.big-lobby-container {
    width: 90%;
    max-width: 900px; /* More compact */
    text-align: center;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px);
    padding: 40px 30px;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

/* Flex layout for Lobby Info */
.lobby-info-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: 25px;
    width: 100%;
}

.lobby-info-item {
    flex: 1;
    padding: 0 15px;
}

.lobby-divider-v {
    width: 1px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
}

.lobby-qr-container {
    background: white;
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: 130px;
    transition: transform 0.3s ease;
}

.lobby-qr-container:hover {
    transform: scale(1.05);
}

.lobby-qr-container img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.big-lobby-id {
    font-size: 3.5rem; /* Scaled down from 5.5 */
    font-weight: 900;
    color: var(--accent-blue);
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
    letter-spacing: 4px;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    margin: 10px 0;
}

.lobby-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.lobby-url-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin-top: 10px;
    word-break: break-all;
}

.big-players-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-top: 40px;
    width: 100%;
}

.big-player-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px 25px;
    /* Smaller padding */
    display: flex;
    flex-direction: row;
    /* Horizontal card */
    align-items: center;
    gap: 15px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 200px;
}

.big-player-card.new {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.big-player-avatar {
    font-size: 2rem;
    /* Smaller icon */
}

.big-player-name {
    font-size: 1.3rem;
    /* Slightly smaller text */
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.qr-placeholder {
    margin: 20px auto;
    width: 150px;
    height: 150px;
    background: white;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== Local Mode Setup Specifics ===== */
#setup-local-players,
#setup-local-names {
    display: flex;
    flex-direction: column !important;
    /* Force vertical */
    align-items: center;
    justify-content: flex-start;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

#setup-local-players .form-group,
#setup-local-names .form-group {
    width: 100%;
    margin-bottom: 20px;
    text-align: center;
}

#setup-local-players .player-count-input {
    width: 100px;
    font-size: 1.5rem;
    padding: 10px;
    text-align: center;
    border-radius: 10px;
    border: 2px solid var(--accent-purple);
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

#local-names-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

#setup-local-players button,
#setup-local-names button {
    width: 100%;
    max-width: 300px;
    margin-bottom: 15px;
}

.popup-ranking-partial {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 4px 0;
}

.ranking-manche-badge {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.ranking-header {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 8px;
    text-align: center;
}

.ranking-footer {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 2px;
    margin-top: 6px;
    text-transform: uppercase;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    overflow-x: hidden;
}

.ranking-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    animation: slideInRight 0.4s ease-out backwards;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.ranking-item.top-rank {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.18), rgba(0, 0, 0, 0.1));
    border-color: rgba(234, 179, 8, 0.5);
    box-shadow: 0 0 16px rgba(234, 179, 8, 0.15);
}

.rank-medal {
    font-size: 1.6rem;
    flex-shrink: 0;
    line-height: 1;
}

.rank-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    background: white;
    padding: 2px;
}

.rank-pos {
    font-size: 1.1rem;
    font-weight: 900;
    width: 30px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.rank-name {
    flex-grow: 1;
    text-align: left;
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-val {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--accent-gold);
    flex-shrink: 0;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ranking-item:nth-child(1) { animation-delay: 0.1s; }
.ranking-item:nth-child(2) { animation-delay: 0.2s; }
.ranking-item:nth-child(3) { animation-delay: 0.3s; }
.ranking-item:nth-child(4) { animation-delay: 0.4s; }
.ranking-item:nth-child(5) { animation-delay: 0.5s; }

/* ===== EXPRESS MODE SPECIALIZED UI ===== */
.express-call-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    animation: slideUp 0.4s ease-out;
}

.express-input-capsule {
    background: linear-gradient(135deg, #7e22ce, #4c1d95);
    border: 3px solid #facc15;
    border-radius: 60px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(126, 34, 206, 0.5);
}

.express-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.express-input-label {
    color: #facc15;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.express-field {
    width: 50px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(251, 191, 36, 0.3);
    border-radius: 12px;
    color: white;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 800;
    font-family: inherit;
    transition: all 0.3s ease;
}

.express-field:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: #facc15;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.express-field-btn {
    background: #facc15;
    color: #4c1d95;
    border: none;
    border-radius: 12px;
    padding: 0 15px;
    height: 45px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.express-field-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    background: #fff;
}

.express-field-btn.vowel {
    background: #fff;
    color: #4c1d95;
    border: 2px solid #facc15;
}

.express-field-btn.vowel:hover {
    background: #facc15;
}

.express-input-divider {
    width: 2px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== PREMIUM EXPRESS WINNINGS BANNER ===== */
.express-banner {
    position: fixed;
    top: 12px;
    right: 16px;
    left: auto;
    transform: none;
    background: linear-gradient(135deg, #7e22ce 0%, #4c1d95 100%);
    border: 2px solid #facc15;
    border-radius: 40px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 14px rgba(126, 34, 206, 0.4);
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: bannerEntrance 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.express-banner-icon {
    font-size: 1.1rem;
    animation: rocketShake 2s infinite ease-in-out;
}

.express-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.express-banner-title {
    color: #facc15;
    font-weight: 900;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.express-banner-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.3);
}

.express-banner-player {
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
}

.express-banner-amount {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 10px;
    border-radius: 20px;
    color: #fff;
    font-weight: 900;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 70px;
    text-align: center;
    position: relative;
}

.express-banner-flash {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    font-weight: 900;
    pointer-events: none;
    animation: flashSlideUp 0.9s ease-out forwards;
    white-space: nowrap;
}

.flash-gain { color: #4ade80; }
.flash-loss { color: #f87171; }

@keyframes flashSlideUp {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-36px); }
}

.floating-score {
    position: fixed;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.82);
    color: #fbbf24;
    font-size: 1.6rem;
    font-weight: 800;
    padding: 0.25em 0.7em;
    border-radius: 10px;
    border: 2px solid #fbbf24;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    animation: floatScoreUp 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}

.floating-score-express {
    color: #c084fc;
    border-color: #c084fc;
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.9);
}

@keyframes floatScoreUp {
    0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.7); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.15); }
    60%  { opacity: 1; transform: translateX(-50%) translateY(-50px) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-90px) scale(0.9); }
}

@keyframes floatScorePop {
    0%   { opacity: 0; transform: translateX(-50%) scale(0.5); }
    60%  { opacity: 1; transform: translateX(-50%) scale(1.2); }
    100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes bannerEntrance {
    from { opacity: 0; transform: translateY(-40px) scale(0.85); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rocketShake {

    0%,
    100% {
        transform: rotate(0deg) translateY(0);
    }

    25% {
        transform: rotate(-10deg) translateY(-2px);
    }

    75% {
        transform: rotate(10deg) translateY(2px);
    }
}

/* Update express-active wheel value to match */
.wheel-value.express-active {
    background: #7e22ce;
    color: #facc15 !important;
    animation: expressPulse 1s infinite;
    border: 3px solid #facc15;
    font-weight: 900;
}

@keyframes expressPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(251, 191, 36, 0.8);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    }
}

/* ===== FINAL ROUND SPECIAL UI ===== */
.final-round-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 10px;
    animation: slideUp 0.4s ease-out;
}

.final-round-input-capsule {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border: 3px solid #fbbf24;
    border-radius: 60px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 20px rgba(251, 191, 36, 0.3);
}

.final-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.final-input-label {
    color: #fbbf24;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.final-field {
    width: 50px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(251, 191, 36, 0.3);
    border-radius: 12px;
    color: white;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 800;
    font-family: inherit;
    transition: all 0.3s ease;
}

.final-field:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.final-field-btn {
    background: #fbbf24;
    color: #1e293b;
    border: none;
    border-radius: 12px;
    padding: 0 15px;
    height: 45px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.final-field-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    background: #fff;
}

.final-field-btn.vowel {
    background: #fff;
    color: #1e293b;
    border: 2px solid #fbbf24;
}

.final-field-btn.vowel:hover {
    background: #fbbf24;
}

.final-input-divider {
    width: 2px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
}

/* Final Round Banner */
.final-round-banner {
    position: fixed;
    top: 12px;
    left: 16px;
    right: auto;
    transform: none;
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border: 2px solid #fbbf24;
    border-radius: 40px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 14px rgba(251,191,36,0.4);
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: bannerEntrance 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.final-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.final-banner-icon {
    font-size: 1.1rem;
}

.final-banner-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.final-banner-title {
    color: #fcd34d;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    font-weight: 700;
    text-transform: uppercase;
}

.final-banner-value {
    color: #fff;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

/* ===== QUICK ACTIONS (Help, Audio) ===== */
.quick-actions-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9998;
    display: flex;
    gap: 10px;
}

.quick-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--accent-gold);
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-gold);
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--font-family);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.quick-action-btn:hover {
    background: rgba(251, 191, 36, 0.35);
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.6);
    transform: scale(1.12);
}
.quick-action-btn.muted {
    border-color: #f87171;
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
}
.quick-action-btn.muted:hover {
    background: rgba(248, 113, 113, 0.35);
    box-shadow: 0 0 18px rgba(248, 113, 113, 0.6);
}

/* ===== TUTORIAL OVERLAY ===== */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 5, 20, 0.93);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    display: none; /* Force it out of the layout when not active */
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tutorial-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex;
    pointer-events: all;
}

.tutorial-modal {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    background: linear-gradient(145deg, rgba(26,26,62,0.97) 0%, rgba(15,10,40,0.99) 100%);
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 24px;
    padding: 48px 40px 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.08);
    overflow-y: auto;
    animation: tutModalIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes tutModalIn {
    from { transform: scale(0.88) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0);       opacity: 1; }
}

.tutorial-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.07);
    color: #aaa;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tutorial-close-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

.tutorial-step-counter {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* ===== SLIDES ===== */
.tutorial-slides-wrap {
    position: relative;
    overflow: hidden;
}
.tutorial-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 4px 0;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.tutorial-slide.active {
    display: flex;
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}
.tutorial-slide.slide-prev {
    display: none;
    opacity: 0;
    transform: translateX(-40px);
}

.tut-icon {
    font-size: 3.5rem;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(251,191,36,0.35));
}
.tut-title {
    font-size: clamp(1.2rem, 4vw, 1.55rem);
    font-weight: 800;
    text-align: center;
    background: radial-gradient(circle, #ffe681 0%, #d4af37 60%, #a07820 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}
.tut-body {
    font-size: 0.97rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

/* Flow chips (slide 1) */
.tut-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 6px;
}
.tut-chip {
    padding: 8px 16px;
    border-radius: 50px;
    background: color-mix(in srgb, var(--c) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
    color: var(--c);
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}
.tut-arrow { color: var(--text-secondary); font-size: 1.2rem; }

/* Tips (slide 2) */
.tut-tips { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.tut-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.88rem;
}
.tut-tip > span { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.tut-tip strong { color: var(--text-primary); display: block; margin-bottom: 2px; }
.tut-tip small { color: var(--text-secondary); }

/* Steps (slide 3) */
.tut-steps { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.tut-step {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.tut-step strong { color: var(--text-primary); }
.tut-step-n {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
    color: #fff;
}
.tut-note {
    width: 100%;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.25);
    color: var(--accent-gold);
    font-size: 0.85rem;
    text-align: center;
}

/* Rules (slide 4) */
.tut-rules { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.tut-rule {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.tut-rule > span { font-size: 1.2rem; flex-shrink: 0; }
.tut-rule strong { color: var(--text-primary); }
.tut-rule.danger { border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.07); }
.tut-rule.warning { border-color: rgba(251,191,36,0.2); background: rgba(251,191,36,0.05); }

/* Specials (slide 5) */
.tut-specials { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.tut-special {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    font-size: 0.87rem;
    color: var(--text-secondary);
}
.tut-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.tut-badge.express  { background: rgba(251,191,36,0.2); color: #fbbf24; border: 1px solid rgba(251,191,36,0.4); }
.tut-badge.shield   { background: rgba(147,51,234,0.2); color: #a855f7; border: 1px solid rgba(147,51,234,0.4); }
.tut-badge.double   { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.tut-badge.mystery  { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.tut-badge.final    { background: rgba(0,212,255,0.12); color: #00d4ff; border: 1px solid rgba(0,212,255,0.3); }

/* Start btn (slide 6) */
.tut-start-btn {
    margin-top: 10px;
    padding: 16px 40px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 8px 24px rgba(139,92,246,0.4);
    letter-spacing: 0.5px;
}
.tut-start-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(139,92,246,0.55); }
.tut-reopen-hint { font-size: 0.78rem; color: var(--text-secondary); text-align: center; margin-top: 8px; }

/* Dots */
.tutorial-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0 14px;
}
.tut-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
}
.tut-dot.active {
    background: var(--accent-gold);
    width: 24px;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(251,191,36,0.5);
}

/* Nav */
.tutorial-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.tut-nav-btn {
    padding: 11px 22px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
}
.tut-nav-btn:hover { background: rgba(255,255,255,0.13); }
.tut-nav-btn.primary {
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(139,92,246,0.35);
}
.tut-nav-btn.primary:hover { box-shadow: 0 6px 20px rgba(139,92,246,0.5); transform: translateY(-1px); }
/* ===== Site Footer ===== */
.seo-section {
    width: 100%;
    background: rgba(2, 6, 23, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 40px 20px;
}
.seo-content {
    max-width: 800px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    line-height: 1.7;
}
.seo-content h2 {
    color: rgba(255, 255, 255, 0.65);
    font-size: 1rem;
    margin: 0 0 8px;
    font-weight: 600;
}
.seo-content h3 {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    margin: 16px 0 4px;
    font-weight: 600;
}
.seo-content p {
    margin: 0 0 8px;
}
.seo-content strong {
    color: rgba(255, 255, 255, 0.65);
}

.site-footer {
    width: 100%;
    background: linear-gradient(0deg, rgba(2, 6, 23, 0.8) 0%, transparent 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
    padding: 30px 20px 20px 20px;
    text-align: center;
    color: var(--text-secondary);
    position: relative;
    z-index: 5;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 20px;
}

.footer-logo {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.footer-links {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 400;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: rgba(255, 255, 255, 0.6);
}

.footer-copy {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.2);
    line-height: 1.6;
    margin-top: 5px;
}

.footer-link {
    color: rgba(255, 255, 255, 0.25);
    text-decoration: none;
}
.footer-link:hover {
    color: rgba(255, 255, 255, 0.6);
}

.kofi-home-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 20px;
    color: rgba(251, 191, 36, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.kofi-home-btn:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.7);
    color: rgba(251, 191, 36, 1);
}

.kofi-endgame-block {
    margin-top: 14px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 12px;
}

.kofi-endgame-msg {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
    margin-bottom: 8px;
    line-height: 1.4;
}

.kofi-endgame {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: rgba(251,191,36,0.12);
    border: 1px solid rgba(251,191,36,0.35);
    border-radius: 20px;
    color: rgba(251,191,36,0.85);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}
.kofi-endgame:hover {
    background: rgba(251,191,36,0.25);
    border-color: rgba(251,191,36,0.65);
    color: #fbbf24;
    transform: translateY(-1px);
}

.kofi-link {
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
}
.kofi-link:hover {
    color: rgba(251, 191, 36, 0.8);
}

/* ===== MANCHE FINALE ATMOSPHERE ===== */
body.manche-finale {
    background-color: #0a0600;
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(251, 191, 36, 0.12) 0%, transparent 65%),
        radial-gradient(ellipse at 0% 100%, rgba(251, 140, 0, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(251, 140, 0, 0.06) 0%, transparent 50%);
    transition: background-color 1.5s ease;
}

body.manche-finale .game-board {
    border-color: #fbbf24;
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.25), inset 0 0 20px rgba(251, 191, 36, 0.05);
}

body.manche-finale .players-list li.active {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 140, 0, 0.15));
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

/* ===== MANCHE FINALE — STARS + GOLD PULSE ===== */
body.manche-finale::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(1px 1px at 10% 15%, rgba(251,191,36,0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 22% 40%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 35% 8%, rgba(251,191,36,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 48% 25%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 60% 12%, rgba(251,191,36,0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 72% 35%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 83% 18%, rgba(251,191,36,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 92% 45%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 5% 60%, rgba(251,191,36,0.6) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 18% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 88%, rgba(251,191,36,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 45% 65%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 58% 80%, rgba(251,191,36,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 92%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 82% 68%, rgba(251,191,36,0.7) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 95% 78%, rgba(255,255,255,0.6) 0%, transparent 100%);
    animation: starsTwinkle 4s ease-in-out infinite alternate;
}

@keyframes starsTwinkle {
    0%   { opacity: 0.4; }
    50%  { opacity: 1; }
    100% { opacity: 0.5; }
}

body.manche-finale .game-board {
    animation: goldBoardPulse 2.5s ease-in-out infinite;
}

@keyframes goldBoardPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(251,191,36,0.2), inset 0 0 10px rgba(251,191,36,0.03); }
    50%       { box-shadow: 0 0 50px rgba(251,191,36,0.45), inset 0 0 20px rgba(251,191,36,0.08); }
}

/* ===== FINAL DECISION: solve card in evidenza ===== */
.solve-section-card.final-decision-active {
    border: 2px solid #fbbf24;
    border-radius: 16px;
    padding: 16px 20px;
    background: rgba(251, 191, 36, 0.07);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.25);
    animation: solveCardPulse 2s ease-in-out infinite;
}

@keyframes solveCardPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(251,191,36,0.2); }
    50%       { box-shadow: 0 0 45px rgba(251,191,36,0.5); }
}

/* Fix glow su board-frame invece di game-board */
body.manche-finale .board-frame {
    animation: goldBoardPulse 2.5s ease-in-out infinite;
}

/* ===== FINAL ROUND VALUE HEADER (inline, no fixed) ===== */
.final-round-value-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 30px;
    padding: 5px 18px;
    width: fit-content;
    align-self: center;
}

.final-round-value-icon { font-size: 1rem; }

.final-round-value-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #fcd34d;
    text-transform: uppercase;
}

.final-round-value-amount {
    font-size: 1.1rem;
    font-weight: 900;
    color: #fff;
}

/* ===== New Home Setup Card ===== */
.setup-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    padding: 28px 36px;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(20px);
}

.setup-flow-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.setup-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.setup-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-count-pills {
    display: flex;
    gap: 10px;
}

.count-pill {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-size: 1.3rem;
    font-weight: 800;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
}
.count-pill:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.count-pill.active {
    border-color: var(--accent-gold);
    background: rgba(251,191,36,0.15);
    color: var(--accent-gold);
    box-shadow: 0 0 16px rgba(251,191,36,0.3);
}

.names-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.name-input-wrap input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}
.name-input-wrap input:focus {
    outline: none;
    border-color: var(--accent-gold);
    background: rgba(251,191,36,0.07);
}
.name-input-wrap input::placeholder { color: rgba(255,255,255,0.25); }

.setup-start-btn {
    width: 100%;
    max-width: 320px;
    padding: 16px;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.setup-howto-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s ease;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.setup-howto-link:hover { color: var(--accent-gold); }

/* ===== Home Hero ===== */
.home-hero {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px 24px;
    gap: 16px;
}

.home-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.home-logo-icon {
    font-size: 3.8rem;
    filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.6));
    display: block;
}

.home-logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 0.88;
    margin: 0;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
}

.home-tagline {
    color: var(--accent-gold);
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 3px;
    opacity: 0.85;
    margin: 0;
}

.home-rules-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 6px;
}

.home-rule-arrow {
    color: rgba(255,255,255,0.3);
    font-size: 1.1rem;
    font-weight: 300;
}

.home-rule-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 14px;
    padding: 10px 16px;
    min-width: 110px;
    transition: border-color 0.2s ease;
}

.home-rule-chip:hover { border-color: rgba(255,255,255,0.2); }

.home-rule-chip.hrc-win {
    border-color: rgba(251,191,36,0.25);
    background: rgba(251,191,36,0.06);
}

.hrc-icon { font-size: 1.4rem; line-height: 1; }

.hrc-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.hrc-sub {
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== HOME VISUAL STRIP ===== */
.home-visual-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
    width: 100%;
}

.hvs-arrow {
    color: rgba(255,255,255,0.25);
    font-size: 1.2rem;
    font-weight: 300;
    flex-shrink: 0;
}

.hvs-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 16px;
    padding: 14px 16px 12px;
    min-width: 120px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.hvs-step:hover {
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.hvs-step-win {
    border-color: rgba(251,191,36,0.25);
    background: rgba(251,191,36,0.06);
}

.hvs-visual {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mini Wheel */
.hvs-wheel {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: conic-gradient(
        #8b5cf6 0deg 60deg,
        #f59e0b 60deg 120deg,
        #10b981 120deg 180deg,
        #ef4444 180deg 240deg,
        #3b82f6 240deg 300deg,
        #ec4899 300deg 360deg
    );
    animation: spin-slow 8s linear infinite;
    border: 3px solid rgba(255,255,255,0.25);
    box-shadow: 0 0 16px rgba(251,191,36,0.35);
    position: relative;
    flex-shrink: 0;
}

.hvs-wheel-inner {
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid rgba(255,255,255,0.15);
}

.hvs-wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 12px solid var(--accent-gold);
    filter: drop-shadow(0 0 4px rgba(251,191,36,0.8));
}

/* Mini Board Tiles */
.hvs-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
}

.hvs-tile {
    width: 22px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 900;
    font-family: var(--font-display);
    letter-spacing: 0;
}

.hvs-tile.hidden {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.12);
}

.hvs-tile.revealed {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(0,242,255,0.4);
    color: var(--accent-primary);
    box-shadow: 0 0 6px rgba(0,242,255,0.2);
}

/* Prize display */
.hvs-prize {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hvs-trophy { font-size: 2rem; line-height: 1; }

.hvs-prize-amt {
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(251,191,36,0.5);
}

.hvs-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.hvs-sub {
    font-size: 0.63rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.setup-experimental-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(251,191,36,0.05);
    border: 1px dashed rgba(251,191,36,0.3);
    border-radius: 14px;
    padding: 12px 20px;
    width: 100%;
    max-width: 520px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-wrap: wrap;
}
.setup-experimental-banner:hover {
    background: rgba(251,191,36,0.1);
    border-color: rgba(251,191,36,0.55);
}

.exp-badge {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fbbf24;
    background: rgba(251,191,36,0.15);
    border: 1px solid rgba(251,191,36,0.35);
    border-radius: 6px;
    padding: 3px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.exp-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex: 1;
}

.exp-cta {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fbbf24;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .home-hero { padding: 20px 14px 14px; }

    /* Strip con steps orizzontale: scroll invece di wrap verticale */
    .home-visual-strip {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .home-visual-strip::-webkit-scrollbar { display: none; }
    .hvs-step { flex-shrink: 0; min-width: 120px; }
    .hvs-arrow { flex-shrink: 0; }

    .home-rules-strip {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 8px;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .home-rules-strip::-webkit-scrollbar { display: none; }
    .home-rule-chip { min-width: 88px; flex-shrink: 0; padding: 8px 10px; }
    .home-rule-arrow { display: none; }
    .setup-card { padding: 20px 16px; }
    .exp-text { display: none; }
}

/* ===== Mobile Portrait Layout (mp-active) ===== */

#game-screen.mp-active {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    box-sizing: border-box;
}

#game-screen.mp-active .game-top-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    margin-bottom: 0;
}
#game-screen.mp-active .compact-logo { display: none; }
#game-screen.mp-active .manche-indicator {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    opacity: 0.85;
}
#game-screen.mp-active #skip-phrase-btn {
    display: block;
    margin: 6px auto 0;
    font-size: 0.7rem;
    padding: 5px 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Colonna principale: board in alto, controlli+classifiche raggruppati in basso */
#mp-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 6px 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Hint categoria — va a capo invece di tagliare */
#mp-column .hint-display {
    font-size: 0.85rem;
    padding: 5px 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    text-align: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: normal;
    word-break: break-word;
    flex-wrap: wrap;
}

/* Board: tiles grandi, usa dvh */
#mp-column .board-container { padding: 0; width: 100%; box-sizing: border-box; flex-shrink: 0; }
#mp-column .board-frame { padding: 4px; }
#mp-column .game-board-inner { padding: 4px; overflow: hidden; }
#mp-column .tile.invisible { display: none; }

#mp-column .tile {
    /* deduction: mp-col pad 16×2=32 + frame 4×2=8 + inner 4×2=8 + 13gaps×2=26 + 4 safety = 78px */
    width: clamp(20px, calc((100vw - 78px) / 14), 34px);
    height: clamp(30px, calc((100vw - 78px) / 14 * 1.8), 58px);
    font-size: clamp(0.75rem, 5.5vw, 1.3rem);
    border-radius: 4px;
}
#mp-column .board-row { gap: 2px; }
#mp-column .game-board { gap: 4px; }

/* Pulsante gira */
#mp-column .central-action-area {
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 8px 0;
    overflow: hidden;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
#mp-column .btn-spin {
    padding: 13px 36px;
    font-size: 1.1rem;
    border-radius: 50px;
    max-width: 100%;
}

/* Vocale + Risolvi in colonna */
#mp-column .game-actions-row {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}
#mp-column .letters-controls,
#mp-column .solve-section-card {
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: none;
    flex: none;
    gap: 6px;
    overflow: hidden;
    box-sizing: border-box;
}
#mp-column .letters-controls label,
#mp-column .solve-section-card label {
    font-size: 0.62rem;
    white-space: normal;
    text-align: center;
    width: 100%;
    display: block;
}
#mp-column .letters-controls input,
#mp-column .solve-section-card input { height: 34px; font-size: 0.88rem; }
#mp-column .btn-action, #mp-column .btn-solve, #mp-column .btn-pass {
    height: 34px;
    padding: 0 12px;
    font-size: 0.8rem;
}

/* Classifiche in fondo */
#mp-scores {
    display: flex;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: hidden;
}
#mp-scores .players-sidebar,
#mp-scores .wheel-value-sidebar {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 8px 8px 10px;
    font-size: 0.72rem;
    border-radius: 10px;
    position: static;
    box-sizing: border-box;
    overflow: hidden;
}
#mp-scores .sidebar-title,
#mp-scores .value-label { font-size: 0.62rem; margin-bottom: 3px; }
#mp-scores .players-list { gap: 5px; }
#mp-scores .players-list li { padding: 5px 7px; gap: 6px; border-radius: 8px; }
#mp-scores .player-avatar-wrap,
#mp-scores .player-avatar { width: 26px; height: 26px; }
#mp-scores .player-name { font-size: 0.72rem; }
#mp-scores .player-score { font-size: 0.75rem; }
#mp-scores .total-winnings-list { gap: 5px; }
#mp-scores .total-winnings-list li { padding: 5px 7px; gap: 6px; border-radius: 8px; font-size: 0.72rem; }
#mp-scores .total-avatar { width: 26px; height: 26px; }
#mp-scores .win-name { font-size: 0.72rem; font-weight: 700; }
#mp-scores .win-amount { font-size: 0.75rem; }

/* ===== Mobile Landscape — popup manche ridotto ===== */
@media (max-width: 768px) {
    .popup-manche-start {
        padding: 16px 24px;
        gap: 4px;
        width: 70%;
    }
    .popup-manche-hint-large {
        font-size: clamp(1rem, 4vw, 1.6rem);
        margin-bottom: 4px;
    }
    .popup-manche-hint { font-size: 1rem; margin-bottom: 4px; }
    .popup-manche-number { font-size: 0.7rem; }
    .popup-category-label { font-size: 0.62rem; }
    .popup-turn-player { font-size: 0.9rem; margin-top: 4px; gap: 2px; }
    .popup-name { font-size: 1.8rem; margin-top: 4px; }
}
