html,
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f0f0f0;
    overflow-x: hidden;
    text-align: center;
}

/* PAGE */

body {
    padding: 8px;
    box-sizing: border-box;
}

/* HEADER */

header {
    position: relative;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    margin-bottom: 8px;
}

/* Title centred */

.title-area h1 {
    margin: 0;
    font-size: 28px;
    text-align: center;
    white-space: nowrap;
}

/* Help top left */

#helpBtn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 70px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #555;
    color: white;
    cursor: pointer;
}

/* Logo top right */

.logo {
    position: absolute;
    top: 6px;
    right: 10px;
    width: 60px;
    height: auto;
}

/* MODE SELECT */

select {
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 6px;
}

/* STATUS + SCORE */

#status,
#score {
    margin-top: 4px;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    text-align: center;
    width: 100%;
}

/* GAME BOARD */

#gameBoard {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    margin-top: 14px;
    width: 100%;
}

/* COLUMNS */

.column {
    width: 30vw;
    max-width: 170px;
    min-width: 90px;
    height: 340px;
    background: #dcdcdc;
    border: 2px solid #333;
    border-radius: 12px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-start;
    padding: 6px;
    box-sizing: border-box;
    overflow: hidden;
    transition: background 0.2s;
}

    .column.selected {
        background: lightgreen;
    }

    .column.computer-move {
        background: orange;
    }

    .column.other-move {
        background: yellow;
    }

/* MATCHES */

.match {
    width: 90%;
    max-width: 90px;
    height: auto;
    margin: 1px;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

/* BUTTON ROW */

#buttons {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

    /* NUMBER BUTTONS */

    #buttons button {
        width: 52px;
        height: 42px;
        border: none;
        border-radius: 10px;
        background: #333;
        color: white;
        font-size: 20px;
        font-weight: bold;
        cursor: pointer;
        transition: 0.2s;
    }

        #buttons button:hover {
            transform: scale(1.05);
        }

/* NEW GAME BUTTON */

#newGameBtn {
    width: 140px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: #333;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin: 10px auto 0 auto;
    display: block;
    transition: 0.2s;
}

    #newGameBtn:hover {
        transform: scale(1.03);
    }

#resetScoreBtn {
    width: 140px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: #666;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin: 8px auto 0 auto;
    display: block;
}

/* TOP CONTROLS */

/* Controls underneath */

.top-controls {
    margin-top: 15px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

    .top-controls input,
    .top-controls select {
        width: 180px;
        padding: 6px;
        border-radius: 6px;
        box-sizing: border-box;
    }

/* MODAL */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

/* MODAL CONTENT */

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    margin: 5vh auto;
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    position: relative;
}

/* CLOSE BUTTON */

.close-btn {
    position: absolute;
    right: 14px;
    top: 8px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* MODAL TEXT */

.modal h2,
.modal h3 {
    margin-top: 10px;
}

.modal ul {
    padding-left: 20px;
}

.modal li {
    margin-bottom: 10px;
}

/* MOBILE */
@media (max-width: 700px) {
    body {
        padding: 4px;
    }

    /* Header layout */

    header {
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 6px;
    }

    .title-area h1 {
        font-size: 20px;
    }

    #helpBtn {
        width: 60px;
        height: 28px;
        font-size: 12px;
    }

    .logo {
        width: 40px;
    }

    .top-controls input,
    .top-controls select {
        width: 220px;
        font-size: 12px;
    }

    /* Status */

    #status,
    #score {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Board */

    #gameBoard {
        gap: 6px;
        margin-top: 8px;
    }

    .column {
        width: 30vw;
        min-width: 75px;
        height: 220px;
        padding: 4px;
    }

    .match {
        max-height: 34px;
    }

    /* Buttons */

    #buttons {
        gap: 4px;
        margin-top: 8px;
    }

        #buttons button {
            width: 46px;
            height: 38px;
            font-size: 18px;
        }

    #newGameBtn,
    #resetScoreBtn {
        width: 120px;
        height: 38px;
        font-size: 14px;
    }

    /* Help dialog */

    .modal-content {
        width: 94%;
        padding: 14px;
        font-size: 14px;
    }
}
