.game-container {
    padding: 2rem 5%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    animation: fadeInDown 0.6s ease-out;
}

.btn-back {
    align-self: flex-start;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 2rem;
    transition: color 0.2s ease;
    display: inline-block;
}

.btn-back:hover {
    color: var(--text-primary);
}

.header-section {
    text-align: center;
    margin-bottom: 2rem;
}

.header-section h2 {
    font-size: 2.8rem;
    color: #fff;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.dashboard {
    width: 100%;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap; /* Fix layout shifting on mobile */
    justify-content: center;
}

select {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    font-size: 1rem;
    min-width: 120px;
}

select:focus {
    border-color: var(--accent-color);
}

.btn-action {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 4px 15px var(--accent-glow);
    font-size: 1rem;
    min-width: 140px;
}

.btn-action:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-action.stop {
    background: #ef4444;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-action.stop:hover {
    background: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.stats {
    display: flex;
    gap: 1rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-color);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    min-width: 120px;
}

.stat-box.best {
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.stat-value.highlight {
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.3s ease, color 0.3s ease;
}

.message {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    min-height: 28px;
    text-align: center;
    transition: all 0.3s ease;
}

.message.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.message.error {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.message.success {
    color: #10b981;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.message.warning {
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.play-area {
    width: 100%;
    height: 55vh;
    min-height: 400px;
    background: radial-gradient(circle, var(--card-hover) 0%, var(--bg-color) 100%);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    cursor: default;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.play-area.waiting {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.3);
    cursor: crosshair;
}

.play-area.ready {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.3);
}

.target {
    position: absolute;
    background: radial-gradient(circle at 30% 30%, #60a5fa, #2563eb);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    box-shadow: 0 0 20px #3b82f6, inset 0 0 10px rgba(255,255,255,0.5);
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.target.visible {
    transform: translate(-50%, -50%) scale(1);
    animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 15px #3b82f6, inset 0 0 10px rgba(255,255,255,0.5); }
    to { box-shadow: 0 0 35px #60a5fa, inset 0 0 15px rgba(255,255,255,0.8); }
}

@media (max-width: 900px) {
    .dashboard {
        flex-direction: column;
        align-items: stretch;
    }
    .stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    .stat-box {
        flex: 1;
    }
    .play-area {
        height: 50vh;
    }
}

.screenshot-area {
    width: 100%;
    /* Questo wrapper serve come base per html2canvas */
}

/* Modifiche per Countdown & Condividi */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 11, 20, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.countdown-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#countdown-text {
    font-size: 8rem;
    font-weight: 800;
    color: var(--accent-color);
    text-shadow: 0 0 30px var(--accent-glow);
    animation: popIn 1s ease infinite;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

.btn-share {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    font-size: 1rem;
    min-width: unset;
}

.btn-share:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-share.hidden {
    display: none;
}
