* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
    user-select: none;
    -webkit-user-select: none;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFD93D;
}

.stats {
    display: flex;
    gap: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.timer {
    color: #4CAF50;
}

.score {
    color: #FFD93D;
}

.play-field {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
}

.target {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #FF6B6B, #E53935);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    animation: targetPop 0.15s ease-out;
    transform: translate(-50%, -50%);
}

.target::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
}

.target::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10%;
    height: 10%;
    background: #E53935;
    border-radius: 50%;
}

.target.hit {
    animation: targetHit 0.2s ease-out forwards;
    pointer-events: none;
}

@keyframes targetPop {
    from { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes targetHit {
    to { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    font-weight: 700;
    color: #FFD93D;
    text-shadow: 0 0 30px rgba(255, 217, 61, 0.5);
    opacity: 0;
    z-index: 20;
    pointer-events: none;
}

.countdown.visible {
    animation: countdownPop 0.8s ease-out;
}

@keyframes countdownPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.overlay-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #FFD93D;
    margin: 0 0 1rem;
}

.overlay-text {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 1.5rem;
}

.controls-inline {
    margin-bottom: 1.5rem;
}

.overlay-score {
    font-size: 2rem;
    font-weight: 700;
    color: #4CAF50;
    margin: 0 0 0.5rem;
}

.overlay-stats {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 0.5rem;
}

.overlay-best {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 1.5rem;
}

.share-container {
    margin-bottom: 1.5rem;
}

.start-btn {
    background: #FFD93D;
    color: #1a1a2e;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 217, 61, 0.4);
}

.start-btn:active {
    transform: scale(0.98);
}

.home-link {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.2s ease, color 0.2s ease;
    z-index: 200;
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* Hide elements based on state */
.state-idle .header,
.state-countdown .header {
    opacity: 0.3;
}

.state-idle .play-field,
.state-countdown .play-field {
    pointer-events: none;
}

/* New best celebration */
.overlay-title.new-best {
    animation: celebrate 0.5s ease;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); color: #4CAF50; }
}

/* Responsive */
@media (max-width: 600px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .title {
        font-size: 1.25rem;
    }

    .stats {
        gap: 1rem;
        font-size: 1rem;
    }

    .overlay-title {
        font-size: 2rem;
    }

    .countdown {
        font-size: 6rem;
    }
}
