/* ===== Card Recall Game Styles ===== */

/* ===== Game Board Layout ===== */
#game-board {
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

#game-board.active {
    display: flex;
}

/* ===== Instruction Panel ===== */
.instruction-panel {
    background: linear-gradient(135deg, #7A9CB8 0%, #6B8BA8 100%);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.instruction-text {
    color: white;
    font-size: 24px;
    font-weight: bold;
    margin: 0;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.countdown-text {
    color: white;
    font-size: 48px;
    font-weight: bold;
    margin: 10px 0 0 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: countdown-pulse 1s ease-in-out;
}

@keyframes countdown-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.countdown-text.urgent {
    color: #FFD700;
    animation: urgent-pulse 0.5s ease-in-out infinite;
}

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

/* ===== Cards Container ===== */
.cards-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: 0;
    overflow: auto;
}

.cards-container.hidden {
    display: none;
}

.cards-grid {
    display: grid;
    gap: 15px;
    max-width: 100%;
    max-height: 100%;
}

/* Grid layouts for different card counts */
.cards-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cards-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cards-grid.cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* ===== Card Styles ===== */
.game-card {
    background: white;
    border: 3px solid #E0E0E0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.game-card:hover:not(.feedback-mode) {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: var(--secondary-color);
}

.card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.card-name {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== Card Selection State ===== */
.game-card.selected {
    background: linear-gradient(135deg, #A8E6CF 0%, #88D4AB 100%);
    border-color: #5FB883;
    border-width: 4px;
    box-shadow: 0 6px 20px rgba(168, 230, 207, 0.5);
}

.game-card.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4CAF50;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== Card Feedback States ===== */
.game-card.correct-feedback {
    background: linear-gradient(135deg, #4CAF50 0%, #45A049 100%);
    border-color: #2E7D32;
    animation: correct-pop 0.6s ease;
    pointer-events: none;
}

.game-card.correct-feedback .card-image {
    opacity: 0.3;
}

.game-card.correct-feedback::before {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 80px;
    font-weight: bold;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.game-card.wrong-feedback {
    background: linear-gradient(135deg, #E57373 0%, #D32F2F 100%);
    border-color: #B71C1C;
    animation: wrong-shake 0.6s ease;
    pointer-events: none;
}

.game-card.wrong-feedback .card-image {
    opacity: 0.3;
}

.game-card.wrong-feedback::before {
    content: '✗';
    position: absolute;
    color: white;
    font-size: 80px;
    font-weight: bold;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.game-card.missed-feedback {
    background: linear-gradient(135deg, #FFA726 0%, #F57C00 100%);
    border-color: #E65100;
    animation: missed-pulse 0.6s ease;
    pointer-events: none;
}

.game-card.missed-feedback .card-image {
    opacity: 0.3;
}

.game-card.missed-feedback::before {
    content: '○';
    position: absolute;
    color: white;
    font-size: 80px;
    font-weight: bold;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.game-card.neutral-feedback {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== Feedback Animations ===== */
@keyframes correct-pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

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

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

/* ===== Card Flip Animation ===== */
.game-card.flipping {
    animation: card-flip 0.6s ease-in-out;
}

@keyframes card-flip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* ===== Action Panel ===== */
.action-panel {
    background: white;
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.action-panel.hidden {
    display: none;
}

.action-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    min-width: 200px;
}

.action-btn.primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45A049 100%);
    color: white;
}

.action-btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5CBF60 0%, #55B059 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.action-btn.primary:disabled {
    background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===== Feedback Modal Styles ===== */
.feedback-icon {
    font-size: 72px;
    margin-bottom: 10px;
}

.star-rating {
    font-size: 48px;
    margin: 20px 0;
    text-align: center;
}

.stats-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 30px 0;
    width: 100%;
}

.stat-item {
    background: #F5F5F5;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #E0E0E0;
}

.stat-item.correct {
    border-left-color: #4CAF50;
}

.stat-item.missed {
    border-left-color: #FFA726;
}

.stat-item.wrong {
    border-left-color: #E57373;
}

.stat-item.score {
    border-left-color: #7A9CB8;
    grid-column: 1 / -1;
}

.stat-item .stat-label {
    font-size: 16px;
    font-weight: 600;
    color: #666;
}

.stat-item .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

/* ===== Responsive Styles ===== */

/* Tablet */
@media (max-width: 1024px) {
    .game-card {
        width: 130px;
        height: 130px;
    }

    .cards-grid {
        gap: 12px;
    }

    .instruction-text {
        font-size: 22px;
    }

    .countdown-text {
        font-size: 42px;
    }

    .action-btn {
        padding: 12px 30px;
        font-size: 18px;
        min-width: 160px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .cards-container {
        padding: 15px 10px;
    }

    .game-card {
        width: 100px;
        height: 100px;
    }

    .cards-grid {
        gap: 10px;
    }

    .cards-grid.cols-5 {
        grid-template-columns: repeat(4, 1fr);
    }

    .card-name {
        font-size: 11px;
        padding: 3px 8px;
    }

    .game-card.selected::after,
    .game-card.correct-feedback::before,
    .game-card.wrong-feedback::before,
    .game-card.missed-feedback::before {
        font-size: 48px;
    }

    .instruction-text {
        font-size: 20px;
    }

    .countdown-text {
        font-size: 36px;
    }

    .action-btn {
        padding: 12px 25px;
        font-size: 16px;
        min-width: 140px;
    }

    .stats-display {
        grid-template-columns: 1fr;
    }

    .stat-item.score {
        grid-column: 1;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .cards-container {
        padding: 10px;
    }

    .game-card {
        width: 80px;
        height: 80px;
    }

    .cards-grid {
        gap: 8px;
    }

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

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

    .card-name {
        font-size: 10px;
        padding: 2px 6px;
    }

    .game-card.selected::after {
        width: 30px;
        height: 30px;
        font-size: 20px;
        top: 5px;
        right: 5px;
    }

    .game-card.correct-feedback::before,
    .game-card.wrong-feedback::before,
    .game-card.missed-feedback::before {
        font-size: 36px;
    }

    .instruction-text {
        font-size: 18px;
    }

    .countdown-text {
        font-size: 32px;
    }

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