/* Geaneral features */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
    height: 100dvh;
    overflow: hidden;
}

.main-container {
    height: 100dvh;
    width: 100vw;
    margin: 0;
    /* Colore di sicurezza se l'immagine non carica */
    background-color: #1a1a1a; 
    
    /* Percorso relativo: entra nella cartella images che è accanto al file */
    background-image: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('images/background.png'); 
    
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: 
            "header"
            "main"
            "footer";
}

.main-container.no-footer {
    grid-template-rows: 10vh 1fr 0vh;
}

/* Navigation top bar */
.top-bar {
    grid-area: header;
    /* Sfondo semi-trasparente invece del bianco solido */
    background: rgba(255, 255, 255, 0.1); 
    
    /* Effetto sfocatura sullo sfondo */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Supporto Safari */
    
    padding: 12px;
    display: flex;
    justify-content: center;
    gap: 15px;
    
    /* Un bordo sottile per dare definizione */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Navigation bottom bar */
.bottom-bar {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.377)); 
    backdrop-filter: none; 
    border-top: none;
    z-index: 2;
    gap: 10px;
}


/* Main content area */
.main-content {
    grid-area: main;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1px;
    overflow: hidden;
    height: 100%;
}

/* Buttons */
/* Classe BASE per tutti i bottoni del gioco */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #ccc;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    text-transform: uppercase;
    /* Rimuove l'alone blu su Chrome/Safari (Mobile) */
    -webkit-tap-highlight-color: transparent;
    
    /* Impedisce la selezione del testo se tieni premuto troppo a lungo */
    user-select: none;
    -webkit-user-select: none;
}

/* Variante specifica per la TOP BAR (Navigazione) */
.nav-btn {
    padding: 8px 15px; /* Più piccoli */
    border: 1px solid #ccc;
    background: white;
    text-transform: none; /* Magari i menu non li vuoi maiuscoli */
}

.btn:active {
    transform: scale(0.95);
}

.btn:hover {
    filter: brightness(0.9);
}


.blue-btn{
    width: 100%;
    background-color: #2196F3;
    color: white;
    font-size: 1.1rem;
}

.green-btn{
    width: 100%;
    background-color: #4CAF50;
    color: white;
    font-size: 1.1rem;
    z-index: 2;
}

/* Titles */
.title {
    font-size: 2.2rem;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
}

.subtitle {
    font-size: 1.2rem;
    margin-bottom: 5px;
    line-height: 1.45;
    opacity: 0.95;
    text-align: center;
}

/* Divider */
.divider {
    margin: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.486);
}

/* Language */
/* Nascondi di default gli elementi inglesi */
[lang="en"] { 
    display: none !important; 
}

/* Quando il body ha la classe 'en-mode', inverti la visibilità */
body.en-mode [lang="en"] { 
    display: block !important; 
}
body.en-mode [lang="it"] { 
    display: none !important; 
}

/* Per elementi inline come titoli o parole dentro i paragrafi */
body.en-mode span[lang="en"] { 
    display: inline !important; 
}



/* Bet Overlay */
.bet-overlay {
    position: fixed;
    left: 50%;
    bottom: 120px;
    transform: translateX(-50%);
    z-index: 1200;
    width: min(92vw, 620px);
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.bet-overlay.hidden {
    display: none;
}

.bet-popup {
    width: 100%;
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid rgba(255, 215, 0, 0.7);
    border-radius: 18px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
    padding: 16px 18px;
    color: white;
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

.bet-popup-title {
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.bet-popup-hint {
    font-size: 0.92rem;
    text-align: center;
    opacity: 0.9;
    margin-bottom: 14px;
}

.bet-buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.bet-number-btn {
    min-width: 52px;
    height: 46px;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.bet-number-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.bet-number-btn:disabled,
.bet-number-btn.bet-disabled {
    background: rgba(140, 140, 140, 0.25);
    color: rgba(255,255,255,0.45);
    border-color: rgba(255,255,255,0.12);
    cursor: not-allowed;
    opacity: 0.75;
}

.bet-number-btn.bet-selected {
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.25);
}

@media (max-width: 640px) {
    .bet-overlay {
        bottom: 105px;
        width: min(94vw, 560px);
    }

    .bet-number-btn {
        min-width: 46px;
        height: 42px;
    }
}


/* Results overlay */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.result-overlay.hidden {
    display: none;
}

.result-popup {
    width: min(92vw, 520px);
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.20);
    border-radius: 24px;
    padding: 20px;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.result-popup-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 14px;
}

.result-popup-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.result-line {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    line-height: 1.45;
}

.result-line.bad {
    border-color: rgba(255, 99, 99, 0.45);
    background: rgba(255, 80, 80, 0.12);
}

.result-line.good {
    border-color: rgba(102, 255, 153, 0.35);
    background: rgba(80, 255, 120, 0.10);
}

.result-line.neutral {
    border-color: rgba(255,255,255,0.15);
}

.result-strong {
    font-weight: 800;
}

.result-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 16px;
}

.result-popup {
    width: min(92vw, 560px);
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(18, 18, 18, 0.92);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 20px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
    padding: 18px;
    color: white;
}

.result-popup-title {
    text-align: center;
    color: #ffd700;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.result-popup-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.result-row {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, 1fr);
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    align-items: center;
    font-size: 0.95rem;
}

.result-row.header {
    background: rgba(255, 215, 0, 0.12);
    color: #ffd700;
    font-weight: 700;
}

.result-player-name {
    font-weight: 700;
}

.result-highlight {
    border: 1px solid rgba(76, 175, 80, 0.6);
    background: rgba(76, 175, 80, 0.14);
}

.result-danger {
    border: 1px solid rgba(211, 47, 47, 0.6);
    background: rgba(211, 47, 47, 0.14);
}

.trick-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.trick-card-box {
    padding: 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.08);
}

.trick-card-box img {
    width: 90px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    margin-bottom: 6px;
}