@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    --cream: #f3eedf;
    --muted: #91948d;
    --lime: #d8f483
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: #101511;
    color: var(--cream);
    font-family: 'DM Sans', sans-serif
}

main {
    max-width: 1240px;
    margin: auto;
    padding: 0 46px
}

header {
    height: 100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #30372d
}

.brand {
    color: var(--cream);
    text-decoration: none;
    font: 700 15px 'Space Grotesk', sans-serif;
    letter-spacing: 1.5px
}

.brand span {
    color: var(--lime);
    font-size: 29px;
    vertical-align: middle;
    margin-right: 12px
}

.edition,
.eyebrow,
.label,
.game-footer,
footer,
.overlay small {
    font-size: 10px;
    letter-spacing: 1.8px
}

.edition {
    color: var(--muted)
}

.intro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0 34px
}

.eyebrow {
    color: var(--lime);
    font-weight: 700
}

h1 {
    font: 600 clamp(38px, 5vw, 62px) 'Space Grotesk', sans-serif;
    letter-spacing: -3px;
    margin: 12px 0
}

h1 em {
    font-style: normal;
    color: var(--lime)
}

.intro p:last-child {
    color: var(--muted);
    font-size: 14px
}

.badge {
    border: 1px solid #536440;
    border-radius: 50%;
    width: 93px;
    height: 93px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transform: rotate(12deg);
    color: var(--lime);
    font-size: 28px;
    font-weight: 700
}

.badge small {
    font-size: 9px;
    letter-spacing: 1px
}

.game-shell {
    border: 1px solid #3b4634;
    border-radius: 14px;
    overflow: hidden;
    background: #172018;
    box-shadow: 0 20px 80px #0003
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 85px;
    padding: 18px 28px
}

.label {
    display: block;
    color: #929c88;
    font-size: 9px;
    margin-bottom: 6px
}

.hud strong {
    font: 500 25px 'Space Grotesk', sans-serif
}

.hud-right {
    display: flex;
    align-items: center;
    gap: 34px
}

#lives {
    color: var(--lime);
    font-size: 22px;
    white-space: nowrap
}

button {
    cursor: pointer;
    border: 0;
    font-family: inherit
}

#pause {
    border: 1px solid #46513e;
    border-radius: 8px;
    background: transparent;
    color: var(--cream);
    width: 36px;
    height: 36px;
    font-size: 20px
}

button:hover {
    filter: brightness(1.12)
}

button:focus-visible,
canvas:focus-visible {
    outline: 3px solid var(--lime);
    outline-offset: -3px
}

.stage {
    position: relative
}

canvas {
    width: 100%;
    display: block;
    aspect-ratio: 1100/560;
    touch-action: none
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    background: linear-gradient(#10201822, #10191077);
    padding: 20px
}

.overlay[hidden] {
    display: none
}

.overlay h2 {
    font: 600 clamp(24px, 3vw, 40px) 'Space Grotesk', sans-serif;
    letter-spacing: -1px;
    margin: 10px 0
}

.overlay>p:not(.eyebrow) {
    font-size: 13px;
    color: #bbc4b1;
    max-width: 360px;
    line-height: 1.6
}

.overlay button {
    background: var(--lime);
    color: #22301b;
    padding: 16px 26px;
    border-radius: 7px;
    font-size: 12px;
    letter-spacing: 1.3px;
    font-weight: 800;
    margin: 18px 0
}

.overlay button span {
    margin-left: 25px
}

.overlay small {
    color: #a6b299;
    font-size: 9px
}

.game-footer {
    display: flex;
    justify-content: space-between;
    padding: 17px 24px;
    color: #97a58d;
    font-size: 8px;
    letter-spacing: 1px;
    border-top: 1px solid #34422c
}

.game-footer i {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--lime);
    border-radius: 50%;
    margin-right: 8px
}

#status {
    letter-spacing: 0
}

.instructions {
    display: flex;
    justify-content: space-between;
    padding: 30px 0 37px;
    gap: 20px
}

.instructions>div {
    display: flex;
    gap: 14px
}

.number {
    color: #7a8d63;
    font: 400 12px 'Space Grotesk';
    padding-top: 4px
}

h3 {
    font-size: 13px;
    margin: 0 0 7px
}

.instructions p {
    font-size: 11px;
    color: var(--muted);
    margin: 0
}

footer {
    border-top: 1px solid #30372d;
    padding: 23px 0;
    display: flex;
    justify-content: space-between;
    color: #747f6c;
    font-size: 9px;
    letter-spacing: .6px
}

@media(max-width:650px) {
    main {
        padding: 0 16px
    }

    header {
        height: 70px
    }

    .edition,
    .badge {
        display: none
    }

    .intro {
        padding: 25px 0
    }

    h1 {
        letter-spacing: -2px
    }

    .intro p:last-child {
        font-size: 12px
    }

    .hud {
        padding: 14px;
        height: 72px
    }

    .hud-right {
        gap: 14px
    }

    .hud strong {
        font-size: 21px
    }

    .label {
        font-size: 7px;
        letter-spacing: 1px
    }

    canvas {
        aspect-ratio: 3/4;
        object-fit: cover
    }

    .overlay h2 {
        max-width: 230px
    }

    .game-footer {
        padding: 12px;
        font-size: 7px
    }

    .game-footer>span:last-child {
        display: none
    }

    .instructions {
        flex-direction: column;
        padding: 24px 0
    }

    .instructions p {
        font-size: 12px
    }

    footer span {
        display: none
    }
}

.goo-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid #34422c;
    color: #d8f483;
    font-size: 10px;
    letter-spacing: 1px
}

.goo-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 9px
}

.goo-controls progress {
    width: 90px;
    height: 8px;
    accent-color: #d8f483
}

.goo-controls button {
    background: #d8f483;
    color: #22301b;
    border-radius: 5px;
    padding: 9px 12px;
    font-size: 10px;
    font-weight: 700;
    touch-action: none
}

.shooting-hint {
    color: #91948d;
    font-size: 12px;
    margin: 0 0 26px
}

kbd {
    color: #d8f483
}

.overlay>p:not(.eyebrow) {
    max-width: 440px
}

@media(max-width:650px) {
    .goo-controls {
        padding: 10px;
        flex-wrap: wrap;
        font-size: 8px;
        gap: 8px
    }

    .goo-controls label {
        font-size: 8px
    }

    .goo-controls progress {
        width: 55px
    }

    .overlay>p:not(.eyebrow) {
        font-size: 12px
    }

    .overlay .eyebrow {
        font-size: 8px
    }
}

.character-select {
    display: flex;
    gap: 14px;
    margin: 8px 0
}

.character-select[hidden] {
    display: none
}

.overlay .character-card {
    margin: 0;
    padding: 10px 12px;
    background: #17271fee;
    border: 1px solid #526049;
    color: #f3eedf;
    letter-spacing: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 190px
}

.overlay .character-card[aria-pressed=true] {
    border: 2px solid #d8f483;
    background: #2b3a22;
    box-shadow: 0 0 18px #d8f48318
}

.character-card canvas {
    width: 160px;
    height: auto;
    aspect-ratio: 240/130;
    pointer-events: none
}

.overlay .character-card span {
    margin: 6px 0 0;
    font-size: 10px;
    color: #a6b299;
    font-weight: 400
}

.character-card strong {
    font-size: 14px
}

@media(max-width:650px) {
    .character-select {
        gap: 8px
    }

    .overlay .character-card {
        width: 140px;
        padding: 7px
    }

    .character-card canvas {
        width: 120px
    }

    .overlay .character-card span {
        font-size: 8px
    }

    .overlay:has(.character-select:not([hidden])) h2 {
        margin: 3px 0
    }

    .overlay:has(.character-select:not([hidden]))>p {
        margin: 6px 0
    }

    .overlay:has(.character-select:not([hidden])) #start {
        margin: 10px 0
    }
}

@media(max-width:650px) {
    .character-select {
        gap: 6px;
        width: 100%;
        justify-content: center
    }

    .overlay .character-card {
        width: calc((100% - 12px)/3);
        max-width: 140px;
        padding: 7px 3px
    }

    .character-card canvas {
        width: 100%;
        aspect-ratio: 240/130;
        object-fit: contain
    }

    .character-card strong {
        font-size: 12px
    }

    .overlay .character-card span {
        font-size: 8px;
        line-height: 1.3
    }
}

/* Keep the actual game wide; never stretch the cave into portrait. */
#game {
    aspect-ratio: 1100/560;
    height: auto;
    object-fit: contain
}

.rotate-hint {
    display: none;
    color: #d8f483;
    font-size: 12px
}

#landscape-button {
    display: none
}

@media(pointer:coarse) {
    #landscape-button {
        display: inline-block;
        min-height: 40px
    }

    #goo-button {
        min-height: 44px
    }
}

@media(pointer:coarse) and (orientation:portrait) {
    .rotate-hint {
        display: block
    }

    .stage {
        min-height: 360px;
        background: #142b28
    }

    .stage #game {
        position: absolute;
        top: 50%;
        transform: translateY(-50%)
    }

    .overlay {
        padding: 12px
    }
}

.game-shell:fullscreen {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    display: flex;
    flex-direction: column;
    background: #101511
}

.game-shell:fullscreen .stage {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center
}

.game-shell:fullscreen #game {
    position: static;
    transform: none;
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain
}

.game-shell:fullscreen .hud {
    height: 45px;
    padding: 5px 16px;
    flex-shrink: 0
}

.game-shell:fullscreen .hud strong {
    font-size: 18px
}

.game-shell:fullscreen .label {
    font-size: 7px;
    margin-bottom: 2px
}

.game-shell:fullscreen .goo-controls {
    padding: 4px 12px;
    flex-shrink: 0
}

.game-shell:fullscreen .game-footer {
    padding: 6px 12px;
    flex-shrink: 0
}

.game-shell:fullscreen #landscape-button {
    display: inline-block
}

@media(pointer:coarse) and (orientation:landscape) {
    main {
        padding: 0 max(8px, env(safe-area-inset-left))
    }

    header,
    .intro,
    .instructions,
    .shooting-hint,
    main>footer {
        display: none
    }

    .game-shell {
        height: 100dvh;
        border-radius: 0;
        display: flex;
        flex-direction: column
    }

    .hud {
        height: 44px;
        padding: 4px 14px;
        flex-shrink: 0
    }

    .hud strong {
        font-size: 18px
    }

    .label {
        margin-bottom: 2px;
        font-size: 7px
    }

    .hud-right {
        gap: 16px
    }

    .stage {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center
    }

    .stage #game {
        width: auto;
        height: 100%;
        max-width: 100%;
        object-fit: contain
    }

    .goo-controls {
        padding: 4px 12px;
        flex-shrink: 0;
        font-size: 8px
    }

    .game-footer {
        padding: 5px 12px;
        flex-shrink: 0
    }

    .overlay {
        padding: 6px;
        overflow-y: auto
    }

    .overlay h2 {
        font-size: 22px;
        margin: 3px 0
    }

    .overlay>p {
        margin: 4px 0;
        font-size: 11px !important;
        line-height: 1.3 !important
    }

    .overlay .eyebrow {
        font-size: 8px
    }

    .character-select {
        margin: 3px 0;
        gap: 8px
    }

    .overlay .character-card {
        width: 135px;
        padding: 4px
    }

    .character-card canvas {
        width: 105px
    }

    .overlay .character-card span {
        font-size: 8px;
        margin: 2px 0
    }

    .overlay #start {
        padding: 9px 18px;
        margin: 6px 0
    }

    .overlay small {
        font-size: 7px
    }
}

@media(max-height:450px) {
    .game-shell:fullscreen .overlay {
        padding: 6px;
        overflow-y: auto
    }

    .game-shell:fullscreen .overlay h2 {
        font-size: 22px;
        margin: 3px 0
    }

    .game-shell:fullscreen .overlay>p {
        margin: 4px 0;
        font-size: 11px;
        line-height: 1.3
    }

    .game-shell:fullscreen .character-card canvas {
        width: 100px
    }

    .game-shell:fullscreen .character-card {
        padding: 4px;
        width: 130px
    }

    .game-shell:fullscreen #start {
        padding: 9px 18px;
        margin: 5px 0
    }
}