:root {
    --primary-color: #00d2ff;
    --secondary-color: #3a7bd5;
    --accent-win: #00ff88;
    --accent-lose: #ff4b4b;
    --accent-draw: #ffd700;
    --text-color: #ffffff;
    --bg-dark: #0f1016;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.background-blobs {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: radial-gradient(circle at 20% 50%, rgba(0, 210, 255, 0.15), transparent 40%),
                radial-gradient(circle at 80% 30%, rgba(255, 75, 75, 0.1), transparent 40%);
}

.app-wrapper { width: 90%; max-width: 500px; text-align: center; position: relative; }

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    transition: 0.4s;
}

.hidden { display: none !important; }

/* --- LOGIN & MODE --- */
.game-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 1.5rem; text-transform: uppercase; }
.game-title span { color: var(--primary-color); }

.mode-selector {
    display: flex;
    background: rgba(0,0,0,0.3);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.3s;
}

.mode-btn.active {
    background: var(--glass-bg);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.input-group { display: flex; flex-direction: column; gap: 10px; }
input {
    background: rgba(0,0,0,0.3);
    border: var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    text-align: center;
    outline: none;
}
input:focus { border-color: var(--primary-color); }

/* --- GAME --- */
.scoreboard {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(0,0,0,0.2); padding: 15px 20px;
    border-radius: 16px; margin-bottom: 1rem;
}
.score-box { display: flex; flex-direction: column; width: 80px; }
.score-box span:first-child { font-size: 0.75rem; color: rgba(255,255,255,0.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-num { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); }

.turn-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #ffd700;
    font-size: 0.9rem;
    padding: 5px 15px;
    border-radius: 20px;
    margin-bottom: 1rem;
    display: inline-block;
}

/* --- MANI (FIX ORIENTAMENTO) --- */
.battle-arena {
    display: flex; justify-content: center; gap: 2rem;
    margin: 1.5rem 0; min-height: 100px;
}

.hand-icon {
    font-size: 4.5rem;
    display: block;
    transition: transform 0.1s;
}

/* FIX: 
   #hand1 (Sinistra) -> Ruotata 90° (Pugno verso destra)
   #hand2 (Destra) -> Ruotata 90° e Specchiata Y (Pugno verso sinistra)
*/
#hand1 {
    transform: rotate(90deg);
}

#hand2 {
    transform: scaleY(-1) rotate(-90deg); /* Specchia e ruota per guardare l'altro */
}

/* ANIMAZIONE SHAKE */
.shake #hand1 { animation: shakeLeft 0.5s ease infinite; }
.shake #hand2 { animation: shakeRight 0.5s ease infinite; }

@keyframes shakeLeft {
    0% { transform: rotate(90deg) translateY(0); }
    50% { transform: rotate(90deg) translateY(-20px); }
    100% { transform: rotate(90deg) translateY(0); }
}

@keyframes shakeRight {
    0% { transform: scaleY(-1) rotate(90deg) translateY(0); }
    50% { transform: scaleY(-1) rotate(90deg) translateY(-20px); }
    100% { transform: scaleY(-1) rotate(90deg) translateY(0); }
}

/* --- FOOTER & CONTROLS --- */
.result-display h2 { font-size: 1.3rem; min-height: 2rem; margin-bottom: 1.5rem; }
.choices-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 1.5rem; }

.choice-btn {
    background: rgba(255,255,255,0.05); border: var(--glass-border);
    border-radius: 12px; padding: 12px 5px; cursor: pointer; transition: 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.choice-btn:active { transform: scale(0.95); background: rgba(255,255,255,0.1); }
.choice-btn .icon { font-size: 1.8rem; }
.choice-btn .label { font-size: 0.7rem; color: rgba(255,255,255,0.7); text-transform: uppercase; }

.footer-actions { display: flex; gap: 10px; }
.btn { width: 100%; padding: 12px; border-radius: 12px; border: none; font-weight: 600; cursor: pointer; }
.primary-btn { background: var(--primary-color); color: #000; }
.danger-btn { background: rgba(255,75,75,0.2); color: #ff4b4b; }
.secondary-btn { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); }

/* --- OVERLAY PASS THE PHONE --- */
.glass-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 16, 22, 0.95);
    backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: center;
    border-radius: 24px; z-index: 100;
    animation: fadeIn 0.3s ease;
}

.overlay-content h2 { color: #ff4b4b; margin-bottom: 1rem; font-size: 2rem; }
.overlay-content p { font-size: 1.2rem; margin-bottom: 0.5rem; }
.overlay-content .highlight { color: var(--primary-color); font-weight: 700; }
.overlay-content button { margin-top: 2rem; width: auto; padding: 12px 30px; }

.text-win { color: var(--accent-win); }
.text-lose { color: var(--accent-lose); }
.text-draw { color: var(--accent-draw); }