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

body {
    background-image: radial-gradient(#008bbf 2px, transparent 2px), radial-gradient(#008bbf 2px, transparent 2px);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

h1 {
    font-weight: bold;
    text-shadow: -4px 4px 0 #008bbf;
    font-size: 5em;
}

h2 {
    font-weight: bold;
    text-shadow: -3px 3px 0 #008bbf;
    font-size: 4em;
}

input.invalid {
    border-color: red;
}

.btn-primary {
    background-color: #008bbf;
    --bs-btn-hover-bg: #0084b5;
}

.container {
    max-width: 1200px;
    width: 100%;
}

.leaderboard-container {
    max-width: 600px;
    width: 100%;
}

.leaderboard-container ul li {
    background: #f9f9f9;
}

#start-screen,
#victory-screen {
    background: white;
    border-radius: 10px;
    padding: 60px 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#victory-screen {
    display: none;
}

.subtitle {
    color: #666;
    font-size: 1.2em;
}

.mode-selection {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-card {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 40px 30px;
    width: 300px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-card:hover {
    border-color: #008bbf;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.mode-card h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.mode-card p {
    color: #666;
    line-height: 1.6;
    font-size: 1em;
}

.mode-icon {
    font-size: 3em;
    margin-bottom: 20px;
}

#game-container {
    display: none;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.gamecard {
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    perspective: 1000px;
}

.gamecard-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.3s;
    transform-style: preserve-3d;
}

.gamecard.revealed .gamecard-inner {
    transform: rotateY(180deg);
}

.gamecard-back,
.gamecard-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}

.gamecard-back {
    background: linear-gradient(135deg, #008bbf 0%, #764ba2 100%);
    color: white;
    font-size: 4em;
    font-weight: bold;
}

.gamecard-front {
    background: white;
    border: 2px solid #ddd;
    transform: rotateY(180deg);
    overflow: hidden;
}

.gamecard-front img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gamecard-front p {
    font-weight: bold;
    font-size: 1em;
    line-height: 1.3;
    text-align: left;
    overflow-y: auto;
    max-height: 100%;
}

/* Learning mode - cards always visible */
.gamecard.revealed .gamecard-back {
    display: none;
}

/* Selected state in learning mode */
.gamecard.selected {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
}

/* Feedback animations */
.gamecard.correct {
    animation: correctPulse 0.5s ease;
}

.gamecard.incorrect {
    animation: incorrectShake 0.5s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 30px rgba(76, 175, 80, 0.8); }
}

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

/* Matched cards */
.gamecard.matched {
    opacity: 0.6;
    pointer-events: none;
}

/* Fade out animation for learning mode */
.gamecard.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

@media (max-width: 768px) {
    .mode-selection {
        flex-direction: column;
        align-items: center;
    }
}

/* Gold Medal - 1st place */
.list-group-item:nth-child(1) {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-color: #DAA520;
    position: relative;
    overflow: hidden;
}

/* Shining animation effect - using ::after to avoid conflict with Bootstrap's ::before */
.list-group-item:nth-child(1)::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 70%
    );
    animation: shine 3s infinite;
    pointer-events: none;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* Silver Medal - 2nd place */
.list-group-item:nth-child(2) {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    border-color: #A0A0A0;
}

/* Bronze Medal - 3rd place */
.list-group-item:nth-child(3) {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    border-color: #A0522D;
}

/* Make sure content is above the shine effect */
.list-group-item:nth-child(1) > * {
    position: relative;
    z-index: 1;
}
