/**
 * Tamil Alphabet Games - Complete Suite
 * Version: 1.0.0
 * Styles for 8 engaging letter recognition games
 */

/* ==========================================
   CSS VARIABLES
   ========================================== */
:root {
    --tag-primary: #667eea;
    --tag-primary-dark: #764ba2;
    --tag-secondary: #FF6B9D;
    --tag-secondary-dark: #FF8E53;
    --tag-success: #4CAF50;
    --tag-error: #f44336;
    --tag-warning: #FF9800;
    --tag-info: #2196F3;
    
    --tag-gradient-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --tag-gradient-pink: linear-gradient(135deg, #FF6B9D 0%, #FF8E53 100%);
    --tag-gradient-success: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    
    --tag-bg: #F7F9FC;
    --tag-text: #2D3748;
    --tag-text-light: #718096;
    --tag-border: #E2E8F0;
    --tag-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --tag-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   MAIN WRAPPER
   ========================================== */
.tag-game-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--tag-bg);
    border-radius: 20px;
}

/* ==========================================
   GAME HEADER
   ========================================== */
.tag-game-header {
    background: var(--tag-gradient-purple);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: var(--tag-shadow);
}

.tag-header-section {
    text-align: center;
    margin-bottom: 20px;
}

.tag-game-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.tag-game-icon {
    font-size: 48px;
}

.tag-game-name {
    font-size: 36px;
    font-weight: 900;
    color: white;
}

.tag-game-subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.tag-stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.tag-stat-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.tag-stat-label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    margin-bottom: 5px;
}

.tag-stat-value {
    font-size: 32px;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.tag-stat-total {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
}

/* ==========================================
   INSTRUCTIONS
   ========================================== */
.tag-instructions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: var(--tag-shadow);
}

.tag-instruction-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--tag-bg);
    border-radius: 10px;
}

.tag-instruction-icon {
    font-size: 28px;
}

.tag-instruction-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--tag-text);
}

/* Replay Audio Button */
.tag-replay-audio-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--tag-gradient-purple);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.tag-replay-audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.tag-replay-audio-btn:active {
    transform: translateY(0);
}

.tag-replay-icon {
    font-size: 20px;
    animation: tagAudioPulse 2s ease infinite;
}

@keyframes tagAudioPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ==========================================
   GAME AREA (COMMON)
   ========================================== */
.tag-game-area {
    background: white;
    border-radius: 20px;
    padding: 40px 20px;
    min-height: 500px;
    box-shadow: var(--tag-shadow);
    position: relative;
    overflow: hidden;
}

/* ==========================================
   FEEDBACK OVERLAY
   ========================================== */
.tag-feedback {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: tagFadeIn 0.3s ease;
}

.tag-feedback-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    transform: scale(0.8);
    animation: tagPop 0.5s ease forwards;
}

.tag-feedback-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.tag-feedback-text {
    font-size: 28px;
    font-weight: 900;
    color: var(--tag-text);
}

.tag-feedback.correct .tag-feedback-content {
    background: var(--tag-gradient-success);
}

.tag-feedback.correct .tag-feedback-text {
    color: white;
}

.tag-feedback.wrong .tag-feedback-content {
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
}

.tag-feedback.wrong .tag-feedback-text {
    color: white;
}

/* ==========================================
   SUCCESS/GAMEOVER SCREENS
   ========================================== */
.tag-success-screen,
.tag-gameover-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: tagFadeIn 0.5s ease;
}

.tag-success-content,
.tag-gameover-content {
    background: white;
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    animation: tagSuccessPop 0.6s ease;
}

.tag-success-icon,
.tag-gameover-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: tagSuccessSpin 1s ease;
}

.tag-success-title,
.tag-gameover-title {
    font-size: 48px;
    font-weight: 900;
    color: var(--tag-text);
    margin: 0 0 10px 0;
}

.tag-success-message,
.tag-gameover-message {
    font-size: 20px;
    color: var(--tag-text-light);
    margin-bottom: 30px;
}

.tag-final-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tag-final-stat {
    background: var(--tag-bg);
    padding: 20px;
    border-radius: 15px;
    min-width: 120px;
}

.tag-final-stat-value {
    font-size: 48px;
    font-weight: 900;
    color: var(--tag-primary);
    line-height: 1;
    margin-bottom: 10px;
}

.tag-final-stat-label {
    font-size: 14px;
    color: var(--tag-text-light);
    font-weight: 600;
}

.tag-replay-btn {
    background: var(--tag-gradient-purple);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--tag-shadow);
}

.tag-replay-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--tag-shadow-hover);
}

.tag-replay-btn:active {
    transform: translateY(0);
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes tagFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tagPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes tagSuccessSpin {
    0% { transform: rotate(0deg) scale(0.5); opacity: 0; }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

/* ==========================================
   GAME 1: LETTER POP BUBBLES
   ========================================== */
.tag-bubbles-area {
    background: linear-gradient(180deg, #e3f2fd 0%, #bbdefb 100%);
}

.tag-bubbles-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    min-height: 450px;
}

.tag-bubble {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(255,255,255,0.2));
    border: 3px solid rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: 900;
    color: #2D3748;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 10px 20px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    animation: tagBubbleFloat 4s ease-in-out infinite;
    position: relative;
    user-select: none;
    /* GPU acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

.tag-bubble:nth-child(1) { animation-delay: 0s; }
.tag-bubble:nth-child(2) { animation-delay: 0.3s; }
.tag-bubble:nth-child(3) { animation-delay: 0.6s; }
.tag-bubble:nth-child(4) { animation-delay: 0.9s; }
.tag-bubble:nth-child(5) { animation-delay: 1.2s; }

.tag-bubble:hover {
    transform: scale(1.15);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3), inset 0 10px 20px rgba(255, 255, 255, 0.4);
}

.tag-bubble:active {
    transform: scale(0.95);
}

.tag-bubble.popping {
    animation: tagBubblePop 0.5s ease forwards;
}

@keyframes tagBubbleFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(3deg);
    }
    50% {
        transform: translateY(-10px) rotate(0deg);
    }
    75% {
        transform: translateY(-15px) rotate(-3deg);
    }
}

@keyframes tagBubblePop {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* ==========================================
   GAME 2: FALLING LETTERS
   ========================================== */
.tag-falling-area {
    background: linear-gradient(180deg, #fff3e0 0%, #ffe0b2 100%);
    position: relative;
    overflow: hidden;
}

.tag-falling-container {
    position: relative;
    height: 500px;
}

.tag-falling-letter {
    position: absolute;
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: 900;
    color: var(--tag-text);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    user-select: none;
    /* GPU acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

.tag-falling-letter:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.tag-falling-letter:active {
    transform: scale(0.95);
}

.tag-falling-letter.caught {
    animation: tagLetterCaught 0.5s ease forwards;
}

.tag-falling-letter.missed {
    animation: tagLetterMissed 0.5s ease forwards;
}

.tag-lives-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    font-size: 32px;
}

.tag-heart {
    transition: all 0.3s ease;
}

.tag-heart.lost {
    opacity: 0.3;
    filter: grayscale(100%);
    transform: scale(0.8);
}

@keyframes tagLetterCaught {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

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

/* ==========================================
   GAME 3: LETTER HIDE & SEEK
   ========================================== */
.tag-hideseek-area {
    background: linear-gradient(180deg, #f3e5f5 0%, #e1bee7 100%);
}

.tag-hidden-letter-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    margin-bottom: 40px;
}

.tag-hidden-letter {
    font-size: 120px;
    font-weight: 900;
    color: var(--tag-text);
    position: relative;
    z-index: 1;
    transition: all 0.5s ease;
}

.tag-hidden-letter.partially-hidden {
    filter: blur(2px);
    opacity: 0.3;
}

.tag-hidden-letter.revealed {
    filter: blur(0);
    opacity: 1;
    animation: tagLetterReveal 0.8s ease;
}

.tag-clouds {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
    transition: all 0.5s ease;
}

.tag-clouds.hidden {
    opacity: 0;
    transform: translateY(-50px);
}

.tag-cloud {
    position: absolute;
    font-size: 80px;
    animation: tagCloudFloat 6s ease-in-out infinite;
}

.tag-cloud-1 {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.tag-cloud-2 {
    top: 40%;
    right: 25%;
    animation-delay: 1s;
}

.tag-cloud-3 {
    bottom: 30%;
    left: 30%;
    animation-delay: 2s;
}

.tag-choices-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.tag-choice-btn {
    background: white;
    width: 120px;
    height: 120px;
    border-radius: 20px;
    border: 4px solid var(--tag-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: 900;
    color: var(--tag-text);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    user-select: none;
}

.tag-choice-btn:hover {
    transform: translateY(-5px);
    border-color: var(--tag-primary);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.tag-choice-btn:active {
    transform: translateY(0);
}

.tag-choice-btn.correct {
    background: var(--tag-gradient-success);
    color: white;
    border-color: transparent;
    animation: tagChoiceCorrect 0.6s ease;
}

.tag-choice-btn.wrong {
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
    color: white;
    border-color: transparent;
    animation: tagChoiceWrong 0.5s ease;
}

.tag-choice-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

@keyframes tagCloudFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-10px) translateX(5px);
    }
}

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

@keyframes tagChoiceCorrect {
    0%, 100% {
        transform: translateY(-5px) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.15);
    }
}

@keyframes tagChoiceWrong {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
    .tag-game-wrapper {
        padding: 15px;
    }
    
    .tag-game-icon {
        font-size: 36px;
    }
    
    .tag-game-name {
        font-size: 28px;
    }
    
    .tag-game-subtitle {
        font-size: 16px;
    }
    
    .tag-stat-value {
        font-size: 24px;
    }
    
    .tag-bubble {
        width: 100px;
        height: 100px;
        font-size: 48px;
    }
    
    .tag-falling-letter {
        width: 80px;
        height: 80px;
        font-size: 42px;
    }
    
    .tag-hidden-letter {
        font-size: 90px;
    }
    
    .tag-choice-btn {
        width: 100px;
        height: 100px;
        font-size: 48px;
    }
    
    .tag-cloud {
        font-size: 60px;
    }
}

@media (max-width: 480px) {
    .tag-game-area {
        padding: 30px 15px;
        min-height: 400px;
    }
    
    .tag-bubble {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }
    
    .tag-falling-letter {
        width: 70px;
        height: 70px;
        font-size: 36px;
    }
    
    .tag-hidden-letter {
        font-size: 70px;
    }
    
    .tag-choice-btn {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }
    
    .tag-choices-container {
        gap: 15px;
    }
    
    .tag-success-content,
    .tag-gameover-content {
        padding: 30px 20px;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
.tag-bubble:focus,
.tag-falling-letter:focus,
.tag-choice-btn:focus,
.tag-replay-btn:focus {
    outline: 3px solid var(--tag-primary);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
