/* Games Page Styles - Fun & Engaging for Elementary Students */

body[data-page="games"] {
    background: linear-gradient(135deg, #ff9a8b 0%, #a8e6cf 50%, #ffd3a5 100%);
    min-height: 100vh;
    font-size: 20px; /* Increased base font size for games page */
}

.games {
    padding: 3rem 0 5rem;
}

.games-grid {
    display: grid;
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Game Card Animations */
@keyframes cardFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

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

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.9); }
}

/* Game Selection Cards */
.game-card-preview {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 25px;
    padding: 2rem;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    animation: cardFloat 6s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-card-preview:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

/* Game Container Styles */
.game-container {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 25px;
    padding: 2rem;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    position: relative;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

/* Make Poster Painter full-bleed and wide */
#designGameContainer {
    max-width: none;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    border-radius: 0;
    padding-left: min(3vw, 24px);
    padding-right: min(3vw, 24px);
}

.game-header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.game-header-nav h2 {
    margin: 0;
    font-family: var(--font-heading);
    color: #2d3748;
    font-size: 2.4rem; /* Increased game header size */
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #2d3748;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(252, 182, 159, 0.4);
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(252, 182, 159, 0.6);
}

.game-content {
    padding: 1rem 0;
}

.game-card-preview::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.8s;
    opacity: 0;
}

.game-card-preview:hover::before {
    opacity: 1;
    animation: sparkle 2s ease-in-out infinite;
}

/* Game Preview Styles */
.game-preview-header {
    text-align: center;
    z-index: 1;
    position: relative;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    z-index: 1;
    position: relative;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    flex: 1;
}

.stat-icon {
    font-size: 1.8rem; /* Increased stat icon size */
}

.stat span:last-child {
    font-weight: bold;
    color: #2d3748;
    font-size: 1.1rem; /* Increased stat text size */
}

.play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.4rem 2.5rem; /* Increased play button padding */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.3rem; /* Increased play button font size */
    cursor: pointer;
    min-height: 4rem; /* Minimum button height */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100%;
    z-index: 1;
    position: relative;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.play-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

/* Game Headers */
.game-header,
.game-preview-header {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.quiz-game .game-icon { animation-delay: 0s; }
.match-game .game-icon { animation-delay: 0.5s; }
.story-game .game-icon { animation-delay: 1s; }
.design-game .game-icon { animation-delay: 1.5s; }

.game-header h3,
.game-preview-header h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: #2d3748;
    margin: 0 0 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-header p,
.game-preview-header p {
    color: #4a5568;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

/* Quiz Styles */
.quiz-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.question-number {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 15px;
    font-weight: bold;
    margin-bottom: 1rem;
    display: inline-block;
    backdrop-filter: blur(10px);
}

.quiz-question {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.quiz-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-options label {
    background: rgba(255, 255, 255, 0.9);
    color: #2d3748;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    border: 3px solid transparent;
}

.quiz-options label:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #ffd700;
}

.quiz-options input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.quiz-progress {
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.quiz-result {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 20px;
    color: #2d3748;
}

.result-animation {
    margin-bottom: 1rem;
}

.trophy {
    font-size: 5rem;
    animation: bounce 1s ease-in-out infinite;
    margin-bottom: 0.5rem;
    display: block;
}

.stars {
    font-size: 2rem;
    animation: sparkle 2s ease-in-out infinite;
}

/* Match Game Styles */
.match-container {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.match-terms, .match-definitions {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.match-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    font-weight: bold;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    user-select: none;
}

.match-item:hover {
    background: white;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.match-item.selected {
    border-color: #ff6b6b;
    background: #ffe0e0;
    animation: glow 2s ease-in-out infinite;
}

.match-item.correct {
    border-color: #51cf66;
    background: #d4edda;
    animation: bounce 0.5s ease-in-out;
}

.match-item.incorrect {
    border-color: #ff6b6b;
    background: #f8d7da;
    animation: shake 0.5s ease-in-out;
}

/* Story Game Styles */
.story-body {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 2rem;
    border-radius: 20px;
}

.story-prompt {
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    font-weight: bold;
    color: #2d3748;
    text-align: center;
}

.panels-container {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.story-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    border: 3px dashed #ddd;
    cursor: move;
    transition: all 0.3s ease;
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    color: #2d3748;
}

.story-panel::before {
    content: attr(data-number);
    position: absolute;
    top: -10px;
    left: -10px;
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.story-panel:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.story-panel.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
}

/* Design Game Styles */
.design-body {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
    padding: 2rem;
    border-radius: 20px;
}

.challenge-prompt {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    font-weight: bold;
    color: #2d3748;
    border-left: 5px solid #ff6b6b;
}

.design-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}


/* Poster Painter Layout */
.poster-studio {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
}

.emoji-picker {
    background: linear-gradient(180deg, #fff 0%, #f7f9ff 100%);
    border-radius: 16px;
    padding: 0.75rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.emoji-picker__header {
    font-weight: 800;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    overflow: auto;
    padding-right: 0.25rem;
}

.emoji-btn {
    font-size: 1.6rem;
    line-height: 1;
    border: none;
    background: #ffffff;
    border-radius: 12px;
    cursor: pointer;
    padding: 0.5rem 0.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.emoji-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.studio-main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.tool-group { display: inline-flex; align-items: center; gap: 0.5rem; }

.tool-btn {
    background: white;
    border: none;
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tool-btn.primary { background: #2b6cb0; color: white; }
.tool-btn.active { outline: 3px solid #ffd166; }
.tool-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.12); }

.tool-label { font-weight: 700; color: #2d3748; display: inline-flex; align-items: center; gap: 0.5rem; }
.tool-label input[type="color"] { width: 42px; height: 32px; border: none; background: transparent; padding: 0; }
.tool-label input[type="range"] { width: 140px; }

.poster-canvas-wrap {
    position: relative;
    background: #ffffff; /* pure white backdrop */
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    padding: 0.5rem;
}

/* Big drawing surface: 4:3 poster that scales responsively */
#posterCanvas {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 5; /* taller than 16:3 for more drawing height */
    display: block;
    border-radius: 12px;
    background: white;
}

.text-overlay {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    padding: 6px 10px;
    border: 2px dashed #4a5568;
    border-radius: 8px;
    background: rgba(255,255,255,0.95);
    font-weight: 800;
    color: #1f2937;
    z-index: 5;
}

@media (max-width: 900px) {
    .poster-studio { grid-template-columns: 1fr; }
    .emoji-picker { order: 2; max-height: 30vh; }
}
.design-option {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 15px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.design-option:hover {
    background: white;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #ffd700;
}

.design-option input[type="radio"] {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    accent-color: #ff6b6b;
}

.design-option.correct {
    border-color: #51cf66;
    background: #d4edda;
    animation: glow 1s ease-in-out;
}

.design-option.incorrect {
    border-color: #ff6b6b;
    background: #f8d7da;
    animation: shake 0.5s ease-in-out;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #2d3748;
    box-shadow: 0 4px 15px rgba(252, 182, 159, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(252, 182, 159, 0.6);
}

.btn-icon {
    font-size: 1.2rem;
    animation: sparkle 2s ease-in-out infinite;
}

/* Action Buttons */
.match-actions, .story-actions, .design-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Feedback Boxes */
.feedback-box {
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    font-weight: bold;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.feedback-box.success {
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
    color: white;
    animation: bounce 0.5s ease-in-out;
}

.feedback-box.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #fa5252 100%);
    color: white;
    animation: shake 0.5s ease-in-out;
}

.feedback-box.info {
    background: linear-gradient(135deg, #74c0fc 0%, #339af0 100%);
    color: white;
}

/* Result Buttons */
.result-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .game-card-preview,
    .game-container {
        padding: 1.5rem;
    }
    
    .quiz-footer, .match-actions, .story-actions, .design-actions, .result-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .game-header-nav {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .game-stats {
        flex-direction: column;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Success Celebration */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}
