/* Shared Systems CSS - Audio & Rewards */

:root {
    --star-gold: #FFD700;
    --star-empty: #E0E0E0;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --primary-kids: #FF6B6B;
}

/* Speaker & Music Buttons */
.system-controls {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.speaker-btn, .music-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 4px solid var(--primary-kids);
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.speaker-btn:hover, .music-toggle:hover {
    transform: scale(1.1);
}

.speaker-btn:active, .music-toggle:active {
    transform: scale(0.9);
}

.music-toggle.muted {
    border-color: #999;
    filter: grayscale(1);
}

/* Reward Stars */
.reward-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.reward-star {
    font-size: 50px;
    color: var(--star-empty);
    text-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s;
    transform: scale(0);
}

.reward-star.active {
    color: var(--star-gold);
    transform: scale(1);
    animation: star-pop 0.5s forwards;
}

@keyframes star-pop {
    0% { transform: scale(0) rotate(-30deg); }
    70% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.reward-star:nth-child(2) { animation-delay: 0.2s; }
.reward-star:nth-child(3) { animation-delay: 0.4s; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    .speaker-btn, .music-toggle {
        width: 50px;
        height: 50px;
        font-size: 24px;
        top: 10px;
        left: 10px;
    }
    
    .reward-star {
        font-size: 40px;
    }
}

/* --- Global UX Polish --- */
button, .choice-card, .card, .shape, .object-emoji, .shadow-card, .emoji-cell, .thumbnail-wrapper, .puzzle-piece {
    -webkit-tap-highlight-color: transparent;
}

/* --- Unified Modal System --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Fallback for games using .hidden from previous versions */
.modal.hidden {
    display: none !important;
}

/* If active is present, never hide it with hidden (transition support) */
.modal.active.hidden {
    display: flex !important;
}

.modal-content {
    background-color: white;
    padding: 2.5rem;
    border-radius: 40px;
    text-align: center;
    border: 8px solid var(--primary-kids);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 90%;
    width: 450px;
    transform: scale(0.7);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 3rem;
    color: var(--primary-kids);
    margin-bottom: 0.5rem;
    font-family: 'FbSpacer', 'Nunito', sans-serif;
    line-height: 1.2;
}

.modal-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 2rem;
}

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

/* Standardized Buttons */
.btn-modal {
    padding: 15px 40px;
    font-size: 1.5rem;
    font-weight: 900;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 80%;
    max-width: 300px;
    text-decoration: none;
    display: inline-block;
}

.btn-modal-primary {
    background-color: #2ed573;
    color: white;
    box-shadow: 0 8px 0 #21a351, 0 15px 20px rgba(46, 213, 115, 0.2);
}

.btn-modal-secondary {
    background-color: #70a1ff;
    color: white;
    box-shadow: 0 8px 0 #4776d0, 0 15px 20px rgba(112, 161, 255, 0.2);
}

.btn-modal-danger {
    background-color: #ff4757;
    color: white;
    box-shadow: 0 8px 0 #d93846, 0 15px 20px rgba(255, 71, 87, 0.2);
}

.btn-modal:hover {
    transform: translateY(-2px);
}

.btn-modal:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 currentColor;
}

/* --- Standardized Navigation --- */
.btn-back-hub {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--primary-kids);
    color: white;
    text-decoration: none;
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 10000; /* Above everything */
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-back-hub:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.btn-back-hub::before {
    content: "🏠";
}

@media (max-width: 768px) {
    .btn-back-hub {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

/* Confetti Container */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.confetti.hidden {
    display: none;
}
