:root {
    font:
        15px system-ui,
        sans-serif;
    color: #e5e9d7;
    background: #112827;
    color-scheme: dark;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
main {
    max-width: 1360px;
    margin: auto;
    padding: 22px 30px;
}
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}
.eyebrow {
    font-size: 10px;
    letter-spacing: 3px;
    color: #b7c796;
}
h1 {
    font:
        46px Georgia,
        serif;
    margin: 6px 0;
}
h1 em {
    font:
        italic 18px Georgia,
        serif;
    margin-left: 16px;
    color: #b5c7b6;
}
.toolbar {
    display: flex;
    gap: 8px;
}
button,
input,
select {
    font: inherit;
    background: #203e37;
    border: 1px solid #587164;
    border-radius: 5px;
    color: #edf0de;
    padding: 9px 12px;
}
button {
    cursor: pointer;
}
button:hover {
    background: #34594b;
}
button:disabled {
    opacity: 0.45;
    cursor: default;
}
:focus-visible {
    outline: 2px solid #f6d995;
    outline-offset: 3px;
}
.game {
    position: relative;
    overflow: hidden;
    border: 1px solid #688274;
    border-radius: 8px;
    background: #162e2b;
}
canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1120/680;
    touch-action: none;
}
.hud {
    position: absolute;
    top: 16px;
    left: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 24px;
    pointer-events: none;
    font-size: 10px;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px #000;
}
.hud b {
    margin-left: 10px;
}
meter {
    display: block;
    width: 135px;
    height: 9px;
}
.quest {
    position: absolute;
    left: 20px;
    top: 76px;
    max-width: 285px;
    padding: 13px;
    background: #112b27c9;
    border-left: 2px solid #d5c281;
    border-radius: 0 4px 4px 0;
    pointer-events: none;
}
.quest p {
    font:
        17px/1.4 Georgia,
        serif;
    margin: 6px 0;
}
#compass {
    font-size: 11px;
    color: #b9d0b7;
}
#toast {
    position: absolute;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 16px;
    border-radius: 5px;
    background: #142c29e8;
    text-align: center;
    max-width: 90%;
    font-size: 13px;
    pointer-events: none;
}
#context {
    position: absolute;
    bottom: 14px;
    width: 100%;
    text-align: center;
    color: #f4e4b7;
    font-size: 12px;
    pointer-events: none;
}
#paused {
    position: absolute;
    inset: 0;
    background: #102925d9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#paused h2 {
    font: 40px Georgia;
    margin: 0;
}
.touch {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
}
.touch div {
    display: flex;
    gap: 6px;
}
.touch button {
    touch-action: none;
    user-select: none;
    min-width: 42px;
}
.panels {
    display: grid;
    grid-template-columns: 0.85fr 1.1fr 1fr;
    gap: 16px;
    margin-top: 8px;
}
article {
    background: #19362f;
    border: 1px solid #3d5a4b;
    padding: 20px;
    border-radius: 7px;
}
h2 {
    font:
        21px Georgia,
        serif;
    color: #dfd19f;
    margin: 0 0 12px;
}
p {
    line-height: 1.5;
}
.hint,
footer,
.lab p,
#save-status {
    font-size: 12px;
    color: #a9bdac;
}
#equipment {
    font-size: 12px;
    color: #dcce9d;
}
.recipe {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #365549;
    padding: 9px 0;
}
.recipe p {
    font-size: 11px;
    margin: 3px 0;
    color: #afc0ae;
}
.recipe button {
    font-size: 12px;
    white-space: nowrap;
}
.recipe strong {
    font-size: 13px;
}
#journal details {
    border-top: 1px solid #365549;
    padding: 10px 0;
}
#journal p {
    font:
        15px/1.6 Georgia,
        serif;
    color: #c1ceb8;
}
#sigils {
    float: right;
    font: 12px system-ui;
}
.lab {
    margin-top: 20px;
    border-top: 1px solid #476458;
    padding: 18px 0;
    color: #a9bdac;
}
summary {
    cursor: pointer;
}
.settings {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
    padding-top: 15px;
}
.settings label {
    display: grid;
    gap: 5px;
    font-size: 12px;
}
.settings input {
    max-width: 150px;
}
footer {
    padding: 15px 0;
}
a {
    color: #d6ca94;
}
[hidden] {
    display: none !important;
}
@media (max-width: 760px) {
    main {
        padding: 12px;
    }
    header {
        display: block;
    }
    h1 {
        font-size: 36px;
    }
    h1 em {
        font-size: 15px;
    }
    .toolbar {
        margin-top: 10px;
    }
    .panels {
        grid-template-columns: 1fr;
    }
    .game canvas {
        aspect-ratio: auto;
        height: auto;
    }
    .quest {
        top: 63px;
        left: 12px;
        max-width: 200px;
        padding: 8px;
    }
    .quest p {
        font-size: 14px;
    }
    .hud {
        gap: 12px;
        top: 10px;
        left: 12px;
        right: 12px;
    }
    .hud meter {
        width: 85px;
    }
    .hud #coordinates {
        display: none;
    }
    .touch {
        flex-direction: column;
        align-items: center;
    }
    .touch button {
        padding: 12px;
    }
    #context {
        font-size: 10px;
        padding: 0 8px;
    }
    #toast {
        bottom: 88px;
        width: max-content;
        max-width: 95%;
    }
}

.hud {
    flex-wrap: wrap;
}
.hud #air {
    width: 90px;
}
#terrain-panel {
    position: absolute;
    left: 16px;
    bottom: 45px;
    max-width: 220px;
    background: #102b29d9;
    border-radius: 5px;
    padding: 8px 11px;
    pointer-events: none;
}
#habitat {
    display: block;
    font-size: 12px;
    color: #a9e5da;
}
#terrain-hint {
    display: block;
    font-size: 11px;
    color: #c0d1ba;
    line-height: 1.4;
    margin-top: 3px;
}
#journal h3 {
    font:
        18px Georgia,
        serif;
    color: #abd6cd;
    margin-top: 24px;
}
.touch div {
    flex-wrap: wrap;
    justify-content: center;
}
@media (max-width: 760px) {
    .hud {
        gap: 8px;
    }
    .hud #air {
        width: 65px;
    }
    .quest {
        top: 90px;
        max-width: 180px;
    }
    #terrain-panel {
        left: 10px;
        bottom: 52px;
        padding: 5px 8px;
        max-width: 135px;
    }
    #terrain-hint {
        display: none;
    }
    .touch button {
        font-size: 12px;
        padding: 10px;
    }
}

#field-compass {
    display: block;
    margin-top: 7px;
    color: #9ed5df;
    font-size: 11px;
    line-height: 1.4;
}
#air-panel b {
    color: #a9e7ef;
}

/* Keep the expedition in the viewport; menus live in the native modal layer. */
html,
body {
    height: 100%;
    overflow: hidden;
}
main {
    height: 100vh;
    height: 100dvh;
    max-width: none;
    padding: 12px 18px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 10px;
}
.game-header {
    margin: 0;
    gap: 12px;
}
.game-header h1 {
    font-size: 30px;
    margin: 2px 0;
}
.game-header h1 em {
    font-size: 15px;
}
.game-header .eyebrow {
    font-size: 8px;
}
.toolbar {
    margin: 0;
}
.toolbar button {
    font-size: 12px;
    padding: 8px 10px;
}
.game {
    min-height: 0;
}
.game canvas {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
}
.touch {
    padding: 0;
    justify-content: center;
    gap: 18px;
    flex-direction: row;
}
.touch button {
    padding: 7px 11px;
    font-size: 12px;
}
.quickbar {
    display: flex;
    justify-content: center;
    gap: 5px;
}
.quickbar button {
    min-width: 108px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 2px solid #718473;
    border-radius: 2px;
    background: #203b32;
    box-shadow:
        inset 2px 2px #a5ae8a40,
        inset -3px -3px #091e20;
    padding: 10px 15px;
    font-size: 12px;
}
.quickbar button:hover,
.quickbar button[aria-expanded="true"] {
    background: #49604a;
    border-color: #e6d8a6;
}
kbd {
    font:
        11px ui-monospace,
        monospace;
    color: #e2d4a6;
    border: 1px solid #819078;
    border-radius: 2px;
    padding: 2px 5px;
}
dialog {
    width: min(760px, calc(100% - 24px));
    max-width: none;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 0;
    margin: auto;
    color: #e5e9d7;
    background: #19362f;
    border: 3px solid #8b9b7f;
    border-radius: 3px;
    box-shadow:
        inset 3px 3px #d4d6ad26,
        inset -3px -3px #071c1a,
        0 20px 90px #0009;
    overflow: hidden;
}
dialog::backdrop {
    background: #061815aa;
    backdrop-filter: blur(2px);
}
.pack-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 18px 22px;
    background: #213f35;
    border-bottom: 2px solid #102a25;
}
.pack-header h2 {
    font:
        26px Georgia,
        serif;
    margin: 5px 0 0;
}
.pack-header .eyebrow {
    font-size: 8px;
    letter-spacing: 2px;
}
.pack-header button {
    font-size: 12px;
    white-space: nowrap;
}
.pack-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 14px 0;
    background: #132f29;
}
.pack-tabs button {
    flex: 1;
    border-radius: 2px 2px 0 0;
    border-bottom: 0;
    padding: 10px 6px;
    font-size: 12px;
}
.pack-tabs button[aria-selected="true"] {
    color: #f6e7b6;
    background: #345044;
    border-color: #bbc097;
    box-shadow: inset 0 2px #e7dab0;
}
.pack-page {
    max-height: calc(100vh - 174px);
    max-height: calc(100dvh - 174px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 22px;
    scrollbar-color: #73886d #142e27;
}
.pack-page h2 {
    margin-bottom: 12px;
}
.item-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 18px 0;
}
.item-slot {
    position: relative;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 2px solid #879377;
    background: #102c27;
    box-shadow:
        inset 3px 3px #061b1b,
        inset -2px -2px #b4b99150;
    font-size: 12px;
}
.item-slot > span:first-child {
    font:
        35px Georgia,
        serif;
    color: #cbb788;
    text-shadow: 2px 2px #0008;
}
.item-slot:nth-child(2) > span:first-child {
    color: #b5c4bb;
}
.item-slot:nth-child(3) > span:first-child {
    color: #d6857b;
}
.item-slot b {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font:
        bold 18px ui-monospace,
        monospace;
    text-shadow: 2px 2px #000;
}
#inventory {
    font-size: 12px;
    color: #acbd9f;
}
#recipes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.recipe {
    align-items: start;
    gap: 10px;
    padding: 14px;
    border: 1px solid #657c61;
    border-radius: 2px;
    background: #234135;
}
.recipe button {
    align-self: center;
}
.lab {
    margin: 0;
    border: 0;
}
.lab footer {
    padding-bottom: 0;
}
.placement-controls {
    position: absolute;
    right: 16px;
    bottom: 46px;
    text-align: right;
}
.placement-controls button {
    background: #19382eee;
    font-size: 12px;
}
@media (max-width: 760px) {
    main {
        padding: 7px;
        gap: 7px;
    }
    .game-header {
        display: flex;
    }
    .game-header h1 {
        font-size: 25px;
    }
    .game-header h1 em,
    .game-header .eyebrow {
        display: none;
    }
    .toolbar {
        gap: 4px;
    }
    .toolbar button {
        font-size: 10px;
        padding: 7px;
    }
    .touch {
        flex-wrap: wrap;
        gap: 5px 12px;
    }
    .touch div {
        gap: 4px;
    }
    .touch button {
        min-width: 34px;
        padding: 8px;
        font-size: 11px;
    }
    .quickbar {
        gap: 4px;
    }
    .quickbar button {
        flex: 1;
        min-width: 0;
        padding: 8px 4px;
        gap: 5px;
        font-size: 11px;
    }
    .quickbar kbd {
        font-size: 10px;
        padding: 2px 3px;
    }
    .pack-header {
        padding: 13px 14px;
    }
    .pack-header h2 {
        font-size: 22px;
    }
    .pack-header button {
        padding: 8px;
    }
    .pack-tabs {
        padding: 7px 8px 0;
        gap: 3px;
    }
    .pack-tabs button {
        font-size: 11px;
    }
    .pack-page {
        padding: 15px;
    }
    .item-slots {
        gap: 8px;
    }
    .item-slot {
        min-height: 100px;
    }
    #recipes {
        grid-template-columns: 1fr;
    }
    .quest {
        top: 65px;
        max-width: 160px;
    }
    .quest .eyebrow,
    .quest p {
        display: none;
    }
    .placement-controls {
        right: 8px;
        bottom: 48px;
    }
}
@media (max-height: 480px) {
    main {
        padding: 4px 8px;
        gap: 4px;
    }
    .game-header h1 {
        font-size: 22px;
    }
    .game-header .eyebrow,
    .game-header h1 em {
        display: none;
    }
    .touch button,
    .quickbar button {
        padding-top: 4px;
        padding-bottom: 4px;
    }
    .quest {
        display: none;
    }
    .pack-header {
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .pack-header h2 {
        font-size: 20px;
    }
    .pack-page {
        max-height: calc(100dvh - 145px);
    }
}

#survey {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}
.camera-tools {
    position: absolute;
    right: 16px;
    top: 66px;
    text-align: right;
    z-index: 1;
}
.camera-tools div {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}
.camera-tools button {
    width: 34px;
    height: 32px;
    padding: 4px;
    font-size: 17px;
    background: #173e36c9;
    border-color: #a4b89475;
}
#camera-heading {
    display: block;
    font-size: 9px;
    color: #ecf0d0;
    text-shadow: 0 1px 3px #102e2a;
    margin-top: 5px;
}
#render-notice:empty {
    display: none;
}
#render-notice {
    color: #f2d194;
}
.view-settings {
    margin-bottom: 10px;
    padding: 0;
}
#menu-settings h2:not(:first-child) {
    margin-top: 24px;
}
@media (max-width: 760px) {
    .camera-tools {
        top: 59px;
        right: 8px;
    }
    .camera-tools button {
        width: 27px;
        height: 28px;
        font-size: 16px;
    }
    #camera-heading {
        font-size: 8px;
    }
    .touch button {
        font-size: 10px;
        padding: 7px;
    }
    .quest {
        max-width: 150px;
    }
}
@media (max-height: 480px) {
    .camera-tools {
        top: 52px;
    }
}

#paused {
    z-index: 4;
    text-align: center;
    padding: 24px;
    background: #102925b8;
    backdrop-filter: blur(3px);
}
#pause-copy {
    max-width: 440px;
    color: #d0dcc3;
}
.arrival-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 20px;
    padding: 18px 22px;
    margin: 10px 0 25px;
    border: 1px solid #80977966;
    background: #16392fd9;
    border-radius: 5px;
}
.arrival-controls span {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #d1ddc4;
}
.arrival-controls kbd {
    align-self: center;
    padding: 5px 10px;
}
.arrival-controls p {
    grid-column: 1/-1;
    margin: 3px 0 0;
    font-size: 11px;
    line-height: 1.7;
    color: #b9cdbb;
}
@media (max-width: 760px) {
    #paused h2 {
        font-size: 32px;
    }
    .arrival-controls {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 14px;
        margin-bottom: 16px;
    }
    .arrival-controls span {
        font-size: 11px;
    }
    #paused {
        padding: 15px;
    }
}
@media (max-height: 480px) {
    .arrival-controls {
        gap: 5px 15px;
        margin: 4px 0 10px;
        padding: 8px;
    }
    .arrival-controls p {
        display: none;
    }
    #pause-copy {
        margin: 8px 0;
    }
    #paused h2 {
        font-size: 28px;
    }
}
#hit-veil {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 45%,
        #c64d32 100%
    );
}
#toast:empty {
    display: none;
}
#mouse-look {
    width: auto;
    height: 28px;
    margin-top: 5px;
    padding: 4px 9px;
    font-size: 11px;
}
#mouse-look[aria-pressed="true"] {
    background: #c7dbaa;
    color: #14352b;
}
@media (pointer: coarse) {
    #mouse-look {
        display: none;
    }
}
