* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.container-fluid {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

.title {
    text-align: center;
    color: white;
    font-size: 3em;
    margin: 30px 0 50px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
}

.game-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 20px;
}

.game-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.game-card.coming-soon {
    opacity: 0.6;
    cursor: default;
}

.game-card.coming-soon:hover {
    transform: none;
}

.game-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.game-card h2 {
    color: #667eea;
    font-size: 2em;
    margin-bottom: 15px;
}

.game-card p {
    color: #666;
    font-size: 1.2em;
}

/* Math Game Styles */
.game-container {
    background: white;
    border-radius: 30px;
    padding: 40px;
    max-width: 800px;
    margin: 20px auto;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
}

.back-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 15px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: background 0.3s;
}

.back-button:hover {
    background: #5568d3;
}

.score {
    text-align: center;
    font-size: 2em;
    color: #667eea;
    margin-bottom: 30px;
    font-weight: bold;
}

.question-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.shapes-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.shape {
    width: 60px;
    height: 60px;
    display: inline-block;
    animation: popIn 0.3s ease-out;
}

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

.shape.square {
    border-radius: 5px;
}

.shape.circle {
    border-radius: 50%;
}

.shape.triangle {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 60px solid;
}

.operator {
    font-size: 4em;
    font-weight: bold;
    color: #333;
}

.equals {
    font-size: 4em;
    font-weight: bold;
    color: #333;
}

.question-mark {
    font-size: 4em;
    color: #667eea;
}

.answers {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin: 40px 0;
}

.answer-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    color: white;
    font-size: 2.5em;
    font-weight: bold;
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.answer-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.answer-btn.correct {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    animation: correct 0.5s ease-out;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    animation: shake 0.5s ease-out;
}

@keyframes correct {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2) rotate(5deg); }
    75% { transform: scale(1.2) rotate(-5deg); }
}

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

.feedback {
    text-align: center;
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0;
    min-height: 60px;
    animation: bounceIn 0.5s ease-out;
}

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

.feedback.correct {
    color: #4ade80;
}

.feedback.wrong {
    color: #f87171;
}

/* Pattern Game Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.level-indicator {
    text-align: center;
    font-size: 2em;
    color: #764ba2;
    font-weight: bold;
}

.instruction {
    text-align: center;
    color: #667eea;
    font-size: 1.8em;
    margin: 20px 0 40px;
}

.pattern-sequence {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
    min-height: 120px;
}

.pattern-item {
    animation: popIn 0.5s ease-out backwards;
}

.pattern-item.small .pattern-shape {
    width: 50px;
    height: 50px;
    font-size: 2.5em;
}

.pattern-item.medium .pattern-shape {
    width: 70px;
    height: 70px;
    font-size: 3.5em;
}

.pattern-item.large .pattern-shape {
    width: 90px;
    height: 90px;
    font-size: 4.5em;
}

.pattern-shape {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.pattern-shape.circle {
    border-radius: 50%;
}

.pattern-shape.triangle {
    width: 0;
    height: 0;
    background: transparent !important;
    box-shadow: none;
    border-left: 35px solid transparent;
    border-right: 35px solid transparent;
    border-bottom: 70px solid;
}

.pattern-item.small .pattern-shape.triangle {
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 50px solid;
}

.pattern-item.large .pattern-shape.triangle {
    border-left: 45px solid transparent;
    border-right: 45px solid transparent;
    border-bottom: 90px solid;
}

.pattern-shape.star,
.pattern-shape.heart {
    font-size: 3.5em;
    line-height: 1;
    background: transparent !important;
    box-shadow: none;
}

.question-item .pattern-shape {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white;
    font-size: 3em;
    font-weight: bold;
}

.drop-zone {
    min-height: 150px;
    margin: 40px auto;
    padding: 20px;
    border: 4px dashed #667eea;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    transition: all 0.3s;
    max-width: 200px;
}

.drop-zone.drag-over {
    background: #e3e7ff;
    border-color: #4facfe;
    transform: scale(1.05);
}

.drop-zone.correct {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
    border-color: #4ade80;
    animation: pulse 0.5s ease-out;
}

.drop-zone.wrong {
    animation: shake 0.5s ease-out;
    border-color: #f87171;
}

.drop-placeholder {
    color: #999;
    font-size: 1.2em;
    text-align: center;
    pointer-events: none;
}

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

.choices-container {
    margin-top: 40px;
}

.choices-title {
    text-align: center;
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 20px;
}

.choices {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 20px;
}

.choice-item {
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.choice-item:hover {
    transform: scale(1.1);
}

.choice-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.hint-button {
    display: block;
    margin: 30px auto 0;
    padding: 15px 40px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.hint-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg) scale(1.1); }
    75% { transform: rotate(10deg) scale(1.1); }
}

.pattern-item.wiggle {
    animation: wiggle 0.5s ease-out;
}

@media (max-width: 768px) {
    .title {
        font-size: 2em;
    }

    .answers {
        grid-template-columns: repeat(3, 1fr);
    }

    .shape {
        width: 40px;
        height: 40px;
    }

    .operator, .equals, .question-mark {
        font-size: 2.5em;
    }

    .pattern-item.small .pattern-shape {
        width: 35px;
        height: 35px;
        font-size: 1.8em;
    }

    .pattern-item.medium .pattern-shape {
        width: 50px;
        height: 50px;
        font-size: 2.5em;
    }

    .pattern-item.large .pattern-shape {
        width: 65px;
        height: 65px;
        font-size: 3.2em;
    }

    .instruction {
        font-size: 1.3em;
    }

    .game-header {
        flex-direction: column;
        gap: 10px;
    }

    .score, .level-indicator {
        font-size: 1.5em;
    }
}

/* Memory Match Game Styles */
.memory-game {
    max-width: 1000px;
}

.memory-board {
    display: grid;
    gap: 15px;
    margin: 30px auto;
    max-width: 900px;
    padding: 20px;
    perspective: 1000px;
}

.memory-board.grid-4x3 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.memory-board.grid-4x4 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.memory-board.grid-5x4 {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.memory-board.grid-6x4 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.memory-card {
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.memory-card:hover:not(.matched) {
    transform: scale(1.05);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.memory-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
}

.card-pattern {
    font-size: 1.5em;
    animation: pulse 2s ease-in-out infinite;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    border: 3px solid #667eea;
}

.memory-card.matched .card-back {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
    border-color: #4ade80;
    animation: matchPulse 0.5s ease-out;
}

.memory-card.shake {
    animation: cardShake 0.5s ease-out;
}

.memory-card.celebrate {
    animation: celebrate 0.8s ease-out;
}

@keyframes matchPulse {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.15); }
}

@keyframes cardShake {
    0%, 100% { transform: rotateY(180deg) translateX(0); }
    25% { transform: rotateY(180deg) translateX(-5px); }
    75% { transform: rotateY(180deg) translateX(5px); }
}

@keyframes celebrate {
    0%, 100% { transform: rotateY(180deg) scale(1) rotate(0deg); }
    25% { transform: rotateY(180deg) scale(1.2) rotate(-10deg); }
    50% { transform: rotateY(180deg) scale(1.2) rotate(10deg); }
    75% { transform: rotateY(180deg) scale(1.2) rotate(-10deg); }
}

.restart-button {
    margin-top: 20px;
}

/* Responsive adjustments for memory game */
@media (max-width: 768px) {
    .memory-board {
        gap: 10px;
        padding: 10px;
    }

    .card-front,
    .card-back {
        font-size: 2em;
        border-radius: 10px;
    }

    .memory-board.grid-6x4 {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(6, 1fr);
    }

    .memory-game {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .card-front,
    .card-back {
        font-size: 1.5em;
    }

    .memory-board {
        gap: 8px;
    }
}

/* Cat Quest Game Styles */
.catquest-game {
    max-width: 100%;
}

.catquest-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (min-width: 1024px) {
    .catquest-layout {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
        align-items: start;
    }
}

.game-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-grid {
    display: grid;
    gap: 5px;
    margin: 0;
    width: 100%;
    max-width: 600px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

@media (min-width: 1024px) {
    .game-grid {
        margin: 0 auto;
    }
}

.grid-cell {
    aspect-ratio: 1;
    background: #e8f5e9;
    border: 2px solid #a5d6a7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    transition: all 0.3s ease;
    position: relative;
}

.grid-cell.obstacle {
    background: #8d6e63;
    border-color: #5d4037;
}

.grid-cell.cat-cell {
    background: #fff9c4;
    border-color: #fbc02d;
    animation: catBounce 0.5s ease-out;
}

.grid-cell.plate-cell {
    background: #ffccbc;
    border-color: #ff7043;
}

.cat-sprite, .plate-sprite {
    width: 90%;
    height: 90%;
    object-fit: contain;
    animation: fadeIn 0.3s ease-out;
}

.cat-sprite.eating {
    animation: eating 1s ease-in-out;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes eating {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.2) rotate(5deg); }
}

.controls-section {
    margin-top: 40px;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

@media (min-width: 1024px) {
    .controls-section {
        margin-top: 0;
        position: sticky;
        top: 20px;
    }
}

.controls-title {
    text-align: center;
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 20px;
}

.current-selection {
    background: #e8f5e9;
    border: 3px solid #81c784;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.2em;
    transition: all 0.3s;
}

.selection-label {
    font-weight: bold;
    color: #667eea;
    margin-right: 10px;
}

.selection-value {
    color: #666;
}

.selection-value.active {
    color: #2e7d32;
    font-weight: bold;
    animation: pulse 0.5s ease-out;
}

.step-title {
    color: #667eea;
    font-size: 1.3em;
    margin: 25px 0 15px;
    text-align: center;
}

.command-display {
    min-height: 120px;
    background: #f8f9fa;
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.command-placeholder {
    color: #999;
    text-align: center;
    font-size: 1.2em;
    padding: 40px;
}

.command-item {
    background: white;
    padding: 12px 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.command-item.executing {
    background: #fff3cd;
    border-color: #ffc107;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(255, 193, 7, 0.3);
}

.command-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
}

.command-count {
    background: #ffc107;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    margin-left: auto;
    font-size: 1.1em;
}

.direction-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.button-row {
    display: flex;
    gap: 10px;
}

.dir-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.3em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    min-width: 120px;
}

.dir-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

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

.dir-btn.selected {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.num-btn {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    border: none;
    padding: 15px;
    font-size: 1.5em;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.num-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.num-btn:active {
    transform: translateY(0) scale(0.95);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 15px 35px;
    font-size: 1.2em;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-weight: bold;
}

.execute-btn {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
}

.execute-btn:hover {
    transform: scale(1.05);
}

.clear-btn {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    color: white;
}

.undo-btn {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.restart-button {
    margin-top: 30px;
}

/* Responsive adjustments for Cat Quest */
@media (max-width: 768px) {
    .game-grid {
        max-width: 400px;
        padding: 15px;
        gap: 3px;
    }

    .grid-cell {
        font-size: 1.5em;
        border-radius: 8px;
    }

    .controls-section {
        padding: 20px;
    }

    .step-title {
        font-size: 1.1em;
        margin: 20px 0 10px;
    }

    .current-selection {
        font-size: 1em;
        padding: 15px;
    }

    .dir-btn {
        padding: 12px 20px;
        font-size: 1.1em;
        min-width: 100px;
    }

    .number-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .num-btn {
        padding: 12px;
        font-size: 1.3em;
    }

    .action-btn {
        padding: 12px 25px;
        font-size: 1em;
    }

    .command-item {
        padding: 10px 15px;
        font-size: 1em;
    }

    .command-count {
        font-size: 0.9em;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .game-grid {
        max-width: 320px;
    }

    .current-selection {
        font-size: 0.9em;
        padding: 12px;
    }

    .step-title {
        font-size: 1em;
    }

    .dir-btn {
        min-width: 80px;
        padding: 10px 15px;
        font-size: 1em;
    }

    .number-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .num-btn {
        padding: 10px;
        font-size: 1.2em;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }
}
