body {
    margin: 0;
    color: #143642;
    background:
        radial-gradient(circle at 10% 12%, rgba(244, 211, 94, 0.28), transparent 38%),
        radial-gradient(circle at 90% 85%, rgba(29, 120, 116, 0.3), transparent 36%),
        linear-gradient(145deg, #f7fff7, #e7f5f2);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

#game-section {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(13, 59, 102, 0.1);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(20, 54, 66, 0.12);
    backdrop-filter: blur(6px);
    padding: 2.2rem;
    margin-bottom: 3rem;
}

.pairs-game-card {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.pairs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
}

.pairs-toolbar label {
    font-weight: 700;
    color: #0d3b66;
}

.pairs-toolbar select,
.pairs-toolbar button {
    border: 1px solid #8ecae6;
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    font-size: 0.95rem;
    color: #143642;
    background: #ffffff;
}

.pairs-toolbar button {
    border: none;
    background: linear-gradient(135deg, #1d7874, #0d3b66);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pairs-toolbar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(13, 59, 102, 0.24);
}

.pairs-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
}

.stat-chip {
    background: linear-gradient(150deg, #ffffff, #effaf8);
    border: 1px solid rgba(29, 120, 116, 0.22);
    border-radius: 14px;
    padding: 0.6rem 0.75rem;
    text-align: center;
}

.stat-chip span {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2a6f97;
}

.stat-chip strong {
    font-size: 1.15rem;
    color: #0d3b66;
}

.status-message {
    margin: 0;
    text-align: center;
    font-weight: 600;
    color: #2f4858;
}

.pairs-board {
    --cols: 5;
    --card-size: clamp(56px, 10vw, 108px);
    width: 100%;
    display: grid;
    grid-template-columns: repeat(var(--cols), var(--card-size));
    justify-content: center;
    gap: 0.75rem;
    margin: 0 auto;
}

.memory-card {
    position: relative;
    min-width: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    aspect-ratio: 3 / 4;
    perspective: 900px;
}

.memory-card[disabled] {
    cursor: default;
}

.memory-card-inner {
    position: absolute;
    inset: 0;
    border-radius: 13px;
    transform-style: preserve-3d;
    transition: transform 0.35s ease;
}

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

.memory-card-face {
    position: absolute;
    inset: 0;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Segoe UI", sans-serif;
    font-weight: 800;
    font-size: clamp(1.35rem, 2vw, 2rem);
    backface-visibility: hidden;
}

.memory-card-back {
    background: linear-gradient(145deg, #0d3b66, #2a6f97);
    color: #f7fff7;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.memory-card-front {
    background: linear-gradient(145deg, #f4d35e, #ee964b);
    color: #0d3b66;
    transform: rotateY(180deg);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.memory-card.matched .memory-card-front {
    background: linear-gradient(145deg, #90e0ef, #55a630);
    color: #0b2545;
}

.internal-nav {
    text-align: center;
    margin-bottom: 3rem;
}

.internal-nav h3 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #0d3b66;
    margin-top: 0;
    margin-bottom: 2rem;
}

.game-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.6rem;
}

.game-btn {
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    padding: 1.2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e9ecef;
    color: #343a40;
    text-decoration: none;
}

.game-btn:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.game-btn img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.game-btn span {
    font-size: 1.2rem;
    font-weight: 600;
}

.info-section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.info-card.full-width {
    grid-column: 1 / -1;
}

.info-card h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #0d3b66;
    margin-top: 0;
    margin-bottom: 1rem;
}

.info-card p,
.info-card li {
    color: #2f4858;
}

.info-card ul {
    margin: 0;
    padding-left: 1.2rem;
}

@media (max-width: 900px) {
    .pairs-board {
        --card-size: clamp(52px, 11vw, 88px);
        gap: 0.6rem;
    }

    .pairs-board[data-level="hard"] {
        --card-size: clamp(46px, 10.5vw, 66px);
        gap: 0.42rem;
    }

    .pairs-board[data-level="hard"] .memory-card-face {
        font-size: clamp(0.95rem, 4vw, 1.35rem);
    }

    .info-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    main {
        padding: 2rem 1rem;
    }

    #game-section,
    .info-section {
        padding: 1.35rem;
    }

    .pairs-board {
        --card-size: clamp(50px, 15vw, 72px);
        gap: 0.5rem;
    }

    .pairs-board[data-level="hard"] {
        --card-size: clamp(42px, 13.2vw, 58px);
        gap: 0.3rem;
    }

    .pairs-board[data-level="hard"] .memory-card-face {
        font-size: clamp(0.82rem, 4.2vw, 1.1rem);
    }
}
