/* Universal Game Styles for Topacy Educational Platform */

/* Game Wrapper and Container */
.game-wrapper {
    min-height: calc(100vh - 80px);
    padding: 2rem 1rem 3rem;
    background: var(--color-bg);
    position: relative;
}

/* Decorative background pattern */
.game-wrapper::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 70%, rgba(147, 197, 253, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.game-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Main Game Card */
.game-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

/* Game Header */
.game-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.game-header h1 {
    color: var(--color-header);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.game-subtitle {
    color: var(--color-text);
    font-size: 1.25rem;
    font-weight: 400;
    opacity: 0.8;
}

/* Progress Container */
.progress-container {
    margin-bottom: 2.5rem;
}

.progress-bar {
    height: 12px;
    background: var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border-radius: 6px;
    width: 10%;
    transition: width 0.4s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--color-text);
}

.progress-text {
    font-weight: 500;
}

.timer {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--color-primary);
}

/* Question Section */
.question-section {
    text-align: center;
    margin-bottom: 3rem;
}

.question-text {
    font-size: 1.75rem;
    color: var(--color-header);
    font-weight: 600;
    line-height: 1.3;
}

/* Answer Grid (for multiple choice games) */
.answer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Answer Buttons - Image Based */
.answer-button {
    background: var(--color-primary-light);
    border: 3px solid transparent;
    border-radius: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    font-family: 'Inter', sans-serif;
}

/* Text-Based Multiple Choice Buttons - Kid-Friendly Design */
.mc-text-button {
    background: var(--color-primary-light);
    border: 3px solid transparent;
    border-radius: 1rem;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    text-align: center;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mc-text-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.15);
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

.mc-text-button:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.mc-text-button.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    transform: scale(1.02);
}

.mc-text-button.correct {
    background: #D1FAE5;
    border-color: #10B981;
    color: #065F46;
    animation: correctPulse 0.6s ease;
}

.mc-text-button.incorrect {
    background: #FECACA;
    border-color: #EF4444;
    color: #991B1B;
    animation: shake 0.5s ease;
}

.answer-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
    border-color: var(--color-primary);
}

.answer-button:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.answer-button.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: scale(1.05);
    color: white;
}

.answer-button.correct {
    background: #D1FAE5; /* soft green */
    border-color: #10B981;
    animation: correctPulse 0.6s ease;
}

.answer-button.incorrect {
    background: #FECACA; /* soft red */
    border-color: #EF4444;
    animation: shake 0.5s ease;
}

/* Answer Images */
.answer-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
    padding: 0.5rem;
}

/* Feedback Messages - Professional Design System */
.feedback-message {
    font-family: 'Inter', sans-serif;
    font-size: 1rem; /* 16px */
    font-weight: 500;
    line-height: 1.5;
    padding: 14px 18px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 1.5rem;
    max-width: 600px;
    animation: fadeIn 0.3s ease;
}

.feedback-message.success {
    background-color: #DCFCE7; /* soft green tint */
    border: 1px solid #86EFAC; /* medium green */
    color: #166534; /* dark green */
}

.feedback-message.error {
    background-color: #FEE2E2; /* soft red tint */
    border: 1px solid #FCA5A5; /* medium red */
    color: #B91C1C; /* dark red */
}

.feedback-message .feedback-icon {
    font-size: 1.25rem; /* 20px */
    flex-shrink: 0;
}

.feedback-message .feedback-text {
    font-size: 1rem; /* 16px */
}

.feedback-message .feedback-text strong {
    font-weight: 600;
    font-size: 1.125rem; /* 18px */
}

/* Button Container */
.button-container {
    text-align: center;
    margin-top: 2rem;
}

/* Action Button Style - Matching Geometric Shapes Exercises */
.btn-action {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-action:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

/* Result Screen */
.result-screen {
    text-align: center;
    padding: 0;
}

.result-content {
    max-width: 500px;
    margin: 0 auto;
}

.result-title {
    font-size: 2.5rem;
    color: var(--color-header);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.score-display,
.time-display {
    text-align: center;
}

.score-label,
.time-label {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text);
    opacity: 0.7;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value,
.time-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.result-message {
    font-size: 1.25rem;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.result-message.excellent {
    background: #D1FAE5;
    color: #065F46;
}

.result-message.good {
    background: #FEF3C7;
    color: #92400E;
}

.result-message.try-again {
    background: #E0E7FF;
    color: #3730A3;
}

/* Input Fields for Input Mode Games */
.input-container {
    max-width: 300px;
    margin: 0 auto 2rem;
}

.game-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.25rem;
    text-align: center;
    border: 3px solid var(--color-border);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.game-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Animations */
@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .game-wrapper {
        padding: 1.5rem 1rem 2rem;
        min-height: calc(100vh - 70px);
    }
    
    .game-card {
        padding: 2rem 1.5rem;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .game-subtitle {
        font-size: 1.125rem;
    }
    
    .question-text {
        font-size: 1.5rem;
    }
    
    .answer-grid {
        gap: 1rem;
    }
    
    .answer-button {
        padding: 0.75rem;
        min-height: 100px;
    }
    
    .mc-text-button {
        font-size: 18px;
        padding: 14px 20px;
        min-height: 60px;
    }
    
    .feedback-message {
        font-size: 0.9375rem; /* 15px */
        padding: 12px 16px;
        gap: 6px;
    }
    
    .feedback-message .feedback-icon {
        font-size: 1.125rem; /* 18px */
    }
    
    .feedback-message .feedback-text strong {
        font-size: 1rem; /* 16px */
    }
    
    .result-title {
        font-size: 2rem;
    }
    
    .score-value,
    .time-value {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .game-card {
        padding: 1.5rem 1rem;
        border-radius: 1rem;
    }
    
    .game-header {
        margin-bottom: 1.5rem;
    }
    
    .game-header h1 {
        font-size: 1.75rem;
    }
    
    .game-subtitle {
        font-size: 1rem;
    }
    
    .question-text {
        font-size: 1.25rem;
        margin-bottom: 2rem;
    }
    
    .answer-grid {
        gap: 0.75rem;
    }
    
    .answer-button {
        padding: 0.5rem;
        min-height: 90px;
    }
    
    .mc-text-button {
        padding: 14px 24px;
        min-height: 56px;
        font-size: 18px;
    }
    
    .answer-image {
        padding: 0.25rem;
    }
    
    .progress-bar {
        height: 10px;
    }
    
    .progress-info {
        font-size: 0.75rem;
    }
    
    .result-stats {
        gap: 2rem;
    }
    
    .result-message {
        font-size: 1.125rem;
    }
    
    .feedback-message {
        font-size: 0.875rem; /* 14px */
        padding: 10px 14px;
    }
    
    .feedback-message .feedback-icon {
        font-size: 1rem; /* 16px */
    }
    
    .feedback-message .feedback-text strong {
        font-size: 0.9375rem; /* 15px */
    }
}

@media (max-width: 360px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .answer-grid {
        gap: 0.5rem;
    }
    
    .answer-button {
        padding: 0.5rem;
        min-height: 80px;
    }
    
    .btn {
        font-size: 14px;
        padding: 0.6rem 1rem;
    }
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
    .answer-button {
        border-width: 4px;
    }
    
    .answer-button.selected,
    .answer-button.correct,
    .answer-button.incorrect {
        border-width: 4px;
    }
}

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