/*--------------------------------------------------------------
# Games Page Specific Styles
--------------------------------------------------------------*/

/* Games Main Layout */
.arcade-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px 40px;
}

.arcade-container {
    width: 100%;
}

.arcade-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
    text-align: center;
}

.arcade-subtitle {
    font-size: 1.1rem;
    color: #666;
    text-align: center;
    margin-bottom: 50px;
}

/* Games Grid */
.arcade-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-top: 0;
    max-width: 1200px;
    margin-left: 0;
    margin-right: auto;
}

/* Game Card */
.arcade-game-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.arcade-game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.arcade-game-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 15px;
}

.arcade-game-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    text-align: center;
}

.arcade-game-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    text-align: center;
}

/*--------------------------------------------------------------
# Modal System
--------------------------------------------------------------*/

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #fff;
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

/* Larger modal for Memory Match game screen */
.modal-content.memory-match-modal {
    max-width: 600px;
}

/* Larger modal for Typing Speed game screen */
.modal-content.typing-speed-modal {
    max-width: 750px;
}

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

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2rem;
    font-weight: 300;
    color: #666;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

#modal-arcade-content {
    margin-top: 20px;
}

/*--------------------------------------------------------------
# Responsive Design for Games
--------------------------------------------------------------*/

@media screen and (max-width: 768px) {
    .arcade-title {
        font-size: 2rem;
    }
    
    .arcade-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    
    .arcade-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .modal-content {
        padding: 30px 20px;
        width: 95%;
    }
    
    .modal-close {
        right: 15px;
        top: 15px;
    }
}

@media screen and (max-width: 480px) {
    .arcade-main {
        padding: 20px 15px;
    }
    
    .arcade-game-card {
        padding: 25px 20px;
    }
    
    .arcade-game-icon {
        font-size: 3rem;
    }
    
    .arcade-game-title {
        font-size: 1.3rem;
    }
}

/*--------------------------------------------------------------
# Math Quiz Game Styles
--------------------------------------------------------------*/

.math-quiz-container {
    text-align: center;
    padding: 20px 0;
}

.math-quiz-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.math-quiz-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
}

/* Operator Selection */
.operator-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 30px;
}

.operator-btn {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.operator-btn:hover {
    border-color: #007bff;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.operator-symbol {
    font-size: 3rem;
    font-weight: 300;
    color: #007bff;
}

.operator-label {
    font-size: 1rem;
    color: #666;
}

/* Difficulty Selection */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.difficulty-btn {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Easy - Green */
.difficulty-btn[onclick*="easy"] {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.4);
}

.difficulty-btn[onclick*="easy"]:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.6);
    transform: translateX(5px);
}

/* Medium - Yellow */
.difficulty-btn[onclick*="medium"] {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.4);
}

.difficulty-btn[onclick*="medium"]:hover {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.6);
    transform: translateX(5px);
}

/* Hard - Red */
.difficulty-btn[onclick*="hard"] {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.4);
}

.difficulty-btn[onclick*="hard"]:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.6);
    transform: translateX(5px);
}

.difficulty-btn:hover {
    border-color: #007bff;
    background: #f8f9ff;
    transform: translateX(5px);
}

.difficulty-label {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a1a;
}

.difficulty-range {
    font-size: 1.1rem;
    color: #666;
}

.back-btn {
    margin-top: 30px;
    background: #f5f5f5;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #e0e0e0;
    color: #333;
}

/* Question Display */
.question-progress {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 30px;
}

.question-display {
    margin: 40px 0 20px 0;
    display: flex;
    justify-content: center;
}

.math-problem {
    font-size: 2.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 40px;
}

/* Vertical Math Problem Layout */
.math-problem-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 3.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 20px;
    margin-right: 60px;
}

.math-number {
    padding: 5px 10px;
    text-align: right;
    min-width: 200px;
}

.math-operator {
    padding: 5px 10px;
    text-align: right;
    min-width: 200px;
}

.math-answer-line {
    border-top: 3px solid #1a1a1a;
    padding-top: 10px;
    margin-top: 10px;
    width: 190px;
    margin-left: 10px;
}

.math-line {
    margin-top: 10px;
}

/* Answer Section */
.answer-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

.answer-input {
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    transition: border-color 0.2s ease;
}

/* Remove number input spinners */
.answer-input::-webkit-inner-spin-button,
.answer-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.answer-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.answer-input:focus {
    outline: none;
    border-color: #007bff;
}

/* Inline answer input (appears below the line in math problem) */
.answer-input-inline {
    font-size: 3.5rem;
    font-weight: 600;
    color: #1a1a1a;
    border: none;
    background: transparent;
    text-align: right;
    padding: 5px 10px;
    width: 200px;
    box-sizing: border-box;
}

.answer-input-inline:focus {
    outline: none;
}

/* Remove number input spinners for inline input */
.answer-input-inline::-webkit-inner-spin-button,
.answer-input-inline::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.answer-input-inline[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide browser number input icons/buttons */
.answer-input-inline::-webkit-textfield-decoration-container {
    display: none;
}

.answer-input-inline::-webkit-calendar-picker-indicator {
    display: none;
}

.submit-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.submit-btn:hover {
    background: #0056b3;
}

/* Results Display */
.results-display {
    margin: 40px 0;
    padding: 40px;
    background: #f8f9ff;
    border-radius: 12px;
}

.score-text {
    font-size: 1.1rem;
    color: #666;
    margin: 5px 0;
}

.score-number {
    font-size: 3rem;
    font-weight: 700;
    color: #007bff;
    margin: 20px 0;
}

.results-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.try-again-btn {
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #007bff;
    color: white;
    border: none;
}

.try-again-btn:hover {
    background: #0056b3;
}

.close-btn {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #e0e0e0;
}

.close-btn:hover {
    background: #e0e0e0;
    color: #333;
}

/* Responsive Math Quiz */
@media screen and (max-width: 480px) {
    .math-quiz-title {
        font-size: 1.5rem;
    }
    
    .operator-buttons {
        grid-template-columns: 1fr;
    }
    
    .math-problem {
        font-size: 2rem;
    }
    
    .score-number {
        font-size: 2.5rem;
    }
    
    .results-buttons {
        flex-direction: column;
    }
}

/*--------------------------------------------------------------
# Memory Match Game Styles
--------------------------------------------------------------*/

.memory-game-container {
    padding: 10px 0;
}

.memory-game-header {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 25px;
}

.memory-stat {
    font-size: 1rem;
    font-weight: 600;
    color: #666;
}

.memory-stat span {
    color: #007bff;
}

/* Memory Grid Layouts */
.memory-grid {
    display: grid;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

.memory-grid-easy {
    grid-template-columns: repeat(4, 70px);
}

.memory-grid-medium {
    grid-template-columns: repeat(6, 70px);
}

.memory-grid-hard {
    grid-template-columns: repeat(6, 70px);
}

/* Memory Card */
.memory-card {
    width: 70px;
    height: 70px;
    perspective: 1000px;
    cursor: pointer;
}

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

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

.memory-card-front,
.memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 2.5rem;
    font-weight: 600;
}

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

.memory-card-back {
    background: white;
    border: 2px solid #e0e0e0;
    transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
    opacity: 0.6;
}

.memory-card.matched {
    cursor: default;
}

/* Memory Results */
.memory-results {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin: 30px 0;
}

.memory-result-item {
    text-align: center;
}

.memory-result-label {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.memory-result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #007bff;
}

/* Responsive Memory Match */
@media screen and (max-width: 768px) {
    .memory-grid-easy {
        grid-template-columns: repeat(4, 65px);
    }
    
    .memory-grid-medium {
        grid-template-columns: repeat(6, 60px);
    }
    
    .memory-grid-hard {
        grid-template-columns: repeat(6, 55px);
    }
    
    .memory-card {
        width: 65px;
        height: 65px;
    }
    
    .memory-grid-medium .memory-card,
    .memory-grid-hard .memory-card {
        width: 60px;
        height: 60px;
    }
    
    .memory-card-front,
    .memory-card-back {
        font-size: 2rem;
    }
}

@media screen and (max-width: 480px) {
    .memory-grid-easy {
        grid-template-columns: repeat(4, 60px);
    }
    
    .memory-grid-medium {
        grid-template-columns: repeat(6, 50px);
    }
    
    .memory-grid-hard {
        grid-template-columns: repeat(6, 45px);
    }
    
    .memory-card {
        width: 60px;
        height: 60px;
    }
    
    .memory-grid-medium .memory-card,
    .memory-grid-hard .memory-card {
        width: 50px;
        height: 50px;
    }
    
    .memory-grid-hard .memory-card {
        width: 45px;
        height: 45px;
    }
    
    .memory-card-front,
    .memory-card-back {
        font-size: 1.5rem;
    }
    
    .memory-game-header {
        gap: 20px;
    }
    
    .memory-results {
        gap: 30px;
    }
    
    .memory-result-value {
        font-size: 2rem;
    }
}

/*--------------------------------------------------------------
# Typing Speed Game Styles
--------------------------------------------------------------*/

.typing-game-container {
    padding: 10px 0;
}

.typing-header {
    text-align: center;
    margin-bottom: 25px;
}

.typing-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.typing-timer {
    font-size: 1rem;
    color: #666;
    font-weight: 600;
}

.typing-timer span {
    color: #007bff;
}

.typing-text-container {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    min-height: 200px;
}

.typing-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.3rem;
    line-height: 1.8;
    color: #333;
    letter-spacing: 0.3px;
    white-space: normal;
    word-spacing: normal;
}

.typing-text .word {
    display: inline-block;
    white-space: nowrap;
}

.typing-text .char {
    position: relative;
    display: inline;
}

.typing-text .untyped {
    color: #999;
}

.typing-text .correct {
    color: #000;
}

.typing-text .error {
    color: #000;
    background-color: rgba(255, 0, 0, 0.25);
    border-radius: 2px;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.5rem;
    background-color: #007bff;
    margin-left: 1px;
    margin-right: 1px;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.typing-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Typing Results */
.typing-results {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.typing-result-item {
    text-align: center;
}

.typing-result-label {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.typing-result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #007bff;
}

/* Responsive Typing Speed */
@media screen and (max-width: 768px) {
    .typing-text {
        font-size: 1.1rem;
        line-height: 1.6;
    }
    
    .typing-text-container {
        padding: 20px;
    }
    
    .typing-results {
        gap: 30px;
    }
}

@media screen and (max-width: 480px) {
    .typing-title {
        font-size: 1.5rem;
    }
    
    .typing-text {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .typing-text-container {
        padding: 15px;
        min-height: 120px;
    }
    
    .typing-results {
        gap: 20px;
    }
    
    .typing-result-value {
        font-size: 2rem;
    }
}

/*--------------------------------------------------------------
# Word Scramble Game Styles
--------------------------------------------------------------*/

.word-scramble-container {
    padding: 20px 0;
}

.word-scramble-header {
    text-align: center;
    margin-bottom: 30px;
}

.word-scramble-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.word-scramble-progress {
    font-size: 1rem;
    color: #666;
    font-weight: 600;
}

.scrambled-word {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    color: #007bff;
    margin: 40px 0;
    text-transform: uppercase;
}

.word-input-container {
    max-width: 400px;
    margin: 0 auto 30px;
    transition: all 0.3s ease;
}

.word-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.word-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.word-input-container.correct-feedback {
    animation: correctShake 0.5s ease;
}

.word-input-container.correct-feedback .word-input {
    border-color: #28a745;
    background-color: #d4edda;
}

.word-input-container.wrong-feedback {
    animation: wrongShake 0.5s ease;
}

.word-input-container.wrong-feedback .word-input {
    border-color: #dc3545;
    background-color: #f8d7da;
}

.correct-answer-display {
    display: none;
    margin-top: 25px;
    font-size: 1.8rem;
    font-weight: 700;
    color: #28a745;
    letter-spacing: 0.3em;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

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

@keyframes correctShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: scale(1.05); }
    75% { transform: scale(0.95); }
}

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

.word-scramble-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    font-size: 1rem;
    font-weight: 600;
}

.stat-correct {
    color: #28a745;
}

.stat-wrong {
    color: #dc3545;
}

/* Word Scramble Results */
.word-scramble-score {
    text-align: center;
    margin-bottom: 30px;
}

.score-main {
    font-size: 4rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 10px;
}

.score-percentage {
    font-size: 2rem;
    color: #666;
}

.word-scramble-stats-results {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
}

.stat-result-item {
    text-align: center;
}

.stat-result-label {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.stat-result-value {
    font-size: 2rem;
    font-weight: 700;
    color: #007bff;
}

/* Responsive Word Scramble */
@media screen and (max-width: 768px) {
    .scrambled-word {
        font-size: 2.5rem;
        letter-spacing: 6px;
    }
    
    .word-input {
        font-size: 1.3rem;
    }
    
    .word-scramble-stats-results {
        gap: 30px;
    }
}

@media screen and (max-width: 480px) {
    .word-scramble-title {
        font-size: 1.5rem;
    }
    
    .scrambled-word {
        font-size: 2rem;
        letter-spacing: 4px;
        margin: 30px 0;
    }
    
    .word-input {
        font-size: 1.1rem;
        padding: 12px 15px;
    }
    
    .word-scramble-stats {
        gap: 20px;
        font-size: 0.9rem;
    }
    
    .word-scramble-stats-results {
        flex-direction: column;
        gap: 20px;
    }
    
    .score-main {
        font-size: 3rem;
    }
    
    .score-percentage {
        font-size: 1.5rem;
    }
    
    .stat-result-value {
        font-size: 1.5rem;
    }
}

