* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #1f2937;
}

header {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 980px;
    margin: 0 auto;
    gap: 8px;
}

h1 {
    margin: 0;
    font-size: 2rem;
}

.info {
    display: flex;
    gap: 10px;
}

.info span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.game {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    position: relative;
}

.left,
.right {
    flex: 1;
    min-height: auto;
    padding: 8px;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    overflow: visible;
    pointer-events: none;
}

button#restart {
    display: block;
    margin: 24px auto;
    padding: 12px 26px;
    border: none;
    border-radius: 14px;
    background: #2563eb;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
}

button#restart:hover {
    background: #1d4ed8;
}

.card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    margin-bottom: 12px;
    border-radius: 14px;
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    text-align: center;
}

.card:last-child {
    margin-bottom: 0;
}

.card img {
    display: block;
    margin: 0 auto;
    max-width: 120px;
    max-height: 120px;
    border-radius: 12px;
}

.card:hover {
    transform: translateY(-1px);
}

.card.selected {
    border-color: #2563eb;
    background: #eff6ff;
}

.card.matched {
    border-color: #10b981;
    background: #ecfdf5;
    opacity: 0.95;
}

.card.disabled {
    border-color: red;
    opacity: 0.55;
    pointer-events: none;
}

@media (max-width: 900px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .game {
        flex-direction: row;
        gap: 8px;
        overflow-x: hidden;
        width: 100%;
        padding-bottom: 0;
    }

    .left,
    .right {
        flex: 1;
        min-width: 0;
        width: 50%;
        padding: 6px;
        border-radius: 10px;
    }

    .card {
        min-height: 100px;
        margin-bottom: 8px;
    }

    .card img {
        max-width: 100px;
        max-height: 100px;
    }
}

#result {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}

#result header {
    justify-content: center;
    padding: 10px;
}