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

.game-board {
    width: 100%;
    height: 500px;
    border: 15px solid rgb(0, 145, 24);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background: linear-gradient(#87CEEB, #E0F6FF);
    /* Taps on the board jump instead of scrolling/zooming/selecting. */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* The canvas fills the board; its pixel size is set from JS (see game.js). */
.game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hud {
    position: absolute;
    top: 12px;
    left: 16px;
    font: bold 20px/1 "Courier New", monospace;
    color: #fff;
    /* dark outline: stays readable over bright and dark sceneries */
    text-shadow: 0 2px 0 #1d3b1f, 0 0 4px #000, 0 0 4px #000;
    pointer-events: none;
}

/* Name of the place, shown for a moment when the scenery changes. */
.scene-name {
    position: absolute;
    top: 14%;
    left: 0;
    width: 100%;
    text-align: center;
    font: bold 32px/1.2 "Courier New", monospace;
    color: #fff;
    text-shadow: 0 3px 0 #1d3b1f, 0 0 8px rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
}

.scene-name.show {
    animation: scene-name 2.5s ease-out;
}

@keyframes scene-name {
    0%   { opacity: 0; }
    15%  { opacity: 1; }
    75%  { opacity: 1; }
    100% { opacity: 0; }
}

.message {
    position: absolute;
    top: 38%;
    left: 0;
    width: 100%;
    padding: 0 16px;
    text-align: center;
    white-space: pre-line;
    font: bold 28px/1.4 "Courier New", monospace;
    color: #fff;
    text-shadow: 0 3px 0 #1d3b1f, 0 0 6px #000, 0 0 6px #000;
    pointer-events: none;
}

.message:empty {
    display: none;
}

.lives {
    color: #ff4d4d;
    letter-spacing: 2px;
    margin-right: 10px;
}

/* Full-board screens: main menu and game over. */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 16px;
    text-align: center;
    font: bold 18px/1.5 "Courier New", monospace;
    color: #fff;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
    background: rgba(0, 0, 0, 0.45);
}

.screen[hidden],
.new-record[hidden] {
    display: none;
}

.screen-gameover {
    background: rgba(40, 0, 0, 0.78);
}

.screen h1,
.screen h2 {
    font-size: 52px;
    line-height: 1;
    letter-spacing: 2px;
}

.screen h1 {
    color: #ffd95a;
    text-shadow: 0 4px 0 #1d3b1f;
}

.screen h2 {
    color: #ff5a5a;
    text-shadow: 0 4px 0 #000;
}

.new-record {
    color: #ffd95a;
}

.hint {
    font-size: 14px;
    font-weight: normal;
    opacity: 0.9;
}

.hint {
    white-space: pre-line;       /* the menu hint has a line break */
}

/* Language choice on the main menu. */
.languages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.btn-lang {
    min-height: 36px;
    padding: 6px 12px;
    font: bold 14px/1 "Courier New", monospace;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: 2px solid #fff;
    border-radius: 6px;
    cursor: pointer;
}

.btn-lang:hover,
.btn-lang:focus-visible {
    background: rgba(255, 255, 255, 0.25);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.btn-lang[aria-pressed="true"] {
    color: #1d3b1f;
    background: #ffd95a;
    border-color: #1d3b1f;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.btn {
    min-width: 200px;
    min-height: 48px;            /* comfortable touch target */
    padding: 10px 20px;
    font: bold 18px/1 "Courier New", monospace;
    color: #1d3b1f;
    background: #ffd95a;
    border: 3px solid #1d3b1f;
    border-radius: 6px;
    box-shadow: 0 4px 0 #1d3b1f;
    cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
    background: #fff;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1d3b1f;
}

.btn-menu {
    color: #fff;
    background: #5a5a5a;
}

.btn-menu:hover,
.btn-menu:focus-visible {
    color: #1d3b1f;
}

/* Victory banner: the frozen game stays visible behind it. */
.screen-victory {
    background: rgba(0, 0, 0, 0.35);
}

.screen-victory h2,
.screen-ending h2 {
    color: #ffd95a;
    font-size: 44px;
}

/* Credits: only the skip button, in the corner, over the canvas. */
.screen-credits {
    background: none;
    align-items: flex-end;
    justify-content: flex-end;
}

.btn-skip {
    min-width: 0;
    min-height: 44px;
    font-size: 15px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border-color: #fff;
    box-shadow: none;
}

/* Ending: on wide boards everything sits at the top, over the sky, so the
   hammock on the sand stays free. On narrow ones the scenery is a band in
   the middle: title above it, buttons below it. */
.screen-ending {
    background: none;
    justify-content: flex-start;
    animation: screen-fade-in 1.2s ease-out;
}

@media (max-width: 700px) {
    .screen-ending {
        justify-content: space-between;
    }
}

.screen-ending > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.screen-ending .btn {
    min-height: 44px;
}

@keyframes screen-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* People who asked their system for less motion get no fades. */
@media (prefers-reduced-motion: reduce) {
    .screen-ending,
    .scene-name.show {
        animation: none;
    }

    .scene-name.show {
        opacity: 1;
    }
}

@media (max-width: 520px) {
    .screen-victory h2,
    .screen-ending h2 {
        font-size: 28px;
    }

    .screen-ending .btn {
        min-width: 0;
        padding: 10px 12px;
        font-size: 14px;
    }

    .screen-ending .buttons {
        flex-wrap: nowrap;
    }

    .screen h1,
    .screen h2 {
        font-size: 36px;
    }
}
