* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    font-family:
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        sans-serif;
    color: #263238;
    background:
        linear-gradient(180deg,
            #c9f0ff 0%,
            #fff4c7 100%);
}

button,
canvas {
    font: inherit;
}

.game-container {
    width: min(100%, 800px);
    margin: 0 auto;
    text-align: center;
}

.game-header {
    margin-bottom: 18px;
}

.game-label {
    margin: 0 0 4px;
    color: #7b5d24;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.15em;
}

h1 {
    margin: 0 0 8px;
    color: #8a631c;
    font-size: clamp(30px, 6vw, 52px);
}

.description {
    margin: 0;
    font-size: 16px;
}

.game-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 8px solid #ffffff;
    border-radius: 24px;
    background-color: #7dd3fc;
    box-shadow: 0 14px 34px rgb(0 0 0 / 18%);
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    background-color: #7dd3fc;
}

.screen-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgb(23 45 67 / 55%);
}

.screen-overlay.hidden {
    display: none;
}

.message-box {
    width: min(100%, 430px);
    padding: 30px 24px;
    border: 4px solid #ffe39b;
    border-radius: 22px;
    background-color: #fffdf4;
    box-shadow: 0 14px 30px rgb(0 0 0 / 22%);
}

.message-icon {
    margin: 0 0 6px;
    font-size: 64px;
}

.message-box h2 {
    margin: 0 0 12px;
    color: #936a18;
    font-size: clamp(26px, 5vw, 38px);
}

.message-box p {
    margin: 0 0 18px;
    line-height: 1.7;
}

.final-score {
    font-size: 24px;
    font-weight: bold;
    color: #dc6b26;
}

button {
    padding: 13px 30px;
    border: none;
    border-radius: 999px;
    color: #ffffff;
    background-color: #e28b24;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition:
        transform 0.2s,
        background-color 0.2s;
}

button:hover {
    background-color: #bf6813;
    transform: translateY(-2px);
}

button:focus-visible {
    outline: 4px solid #fff176;
    outline-offset: 4px;
}

.controls,
.rules {
    margin-top: 18px;
    padding: 18px;
    border-radius: 16px;
    background-color: rgb(255 255 255 / 82%);
}

.controls h2,
.rules h2 {
    margin: 0 0 12px;
    color: #7b5d24;
    font-size: 20px;
}

.control-list,
.rule-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 24px;
}

.control-list span,
.rule-list p {
    margin: 0;
    font-weight: bold;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .game-wrapper {
        border-width: 4px;
        border-radius: 14px;
    }

    .description {
        font-size: 14px;
    }

    .control-list,
    .rule-list {
        flex-direction: column;
        gap: 8px;
    }

    .message-box {
        padding: 22px 16px;
    }

    .message-icon {
        font-size: 48px;
    }
}