* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: #697f9e; color: #f5f1df; font: 15px system-ui, sans-serif; }
#world { display: block; width: 100%; height: 100%; touch-action: none; }
#creative-mode[aria-pressed="true"] { border-color: #f6d588; background: #62593b; }
#world-hud { position: absolute; inset: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) auto max(16px, env(safe-area-inset-left)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; pointer-events: none; }
header { display: grid; justify-items: start; gap: 4px; }
.hud-logo { display: block; width: clamp(88px, 26vw, 112px); max-width: 100%; height: auto; }
.hud-right { display: grid; justify-items: end; gap: 4px; }
#landing-step { width: fit-content; margin: 6px 0 0; padding: 6px 9px; border-left: 2px solid #f6d588; border-radius: 4px; background: #222b43e8; font-size: 12px; line-height: 1.45; }
#facility-prompts { position: absolute; top: calc(50% + 25px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); text-align: center; pointer-events: none; }
#facility-prompts button { min-height: 44px; max-width: 100%; padding: 5px 12px; color: #f5f1df; font-size: 13px; pointer-events: auto; }
@media (max-height: 440px) { #facility-prompts { top: auto; bottom: calc(50% + 23px); } }
#beacon-depart { width: 100%; margin-top: 14px; color: #14252d; background: #a8e0d9; font-weight: 700; }
#flight-scene { position: fixed; z-index: 5; inset: 0; overflow: hidden; background: radial-gradient(circle at 18px 29px,#d5e4ff 1px,transparent 1.5px) 0 0/113px 89px, radial-gradient(circle at 43px 11px,#acc7fd 1px,transparent 1.5px) 0 0/167px 137px; }
.in-flight :is(#world-hud, #inventory, #status, #help, #crosshair, #facility-prompts, #touch, #planet-guidance, #hurt-flash) { visibility: hidden; }
#flight-destination { position: absolute; bottom: 12%; width: 100%; text-align: center; letter-spacing: .08em; }
.flight-orb { position: absolute; right: 12%; top: 14%; width: 26vmin; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 33% 30%,var(--flight-color,#d6a569),#26344f 76%); animation: approach 2.4s ease-in both; }
.west .flight-orb { left: 12%; right: auto; }
@keyframes approach { to { transform: scale(1.32); } }
@media (prefers-reduced-motion: reduce) { .flight-orb { animation: none; } }
#status { position: absolute; left: max(8px, env(safe-area-inset-left)); bottom: calc(env(safe-area-inset-bottom) + 2px); max-width: calc(100% - 16px); padding: 1px 5px; border-radius: 4px; background: #222b43c9; color: #dce7fc; font-size: 11px; line-height: 13px; overflow-wrap: anywhere; pointer-events: none; }
#crosshair { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); font-size: 25px; text-shadow: 0 1px 4px #17271d; pointer-events: none; }
#crosshair.hit { color: #ffc16f; }
#chip-progress { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 35px; height: 4px; border: 0; border-radius: 2px; accent-color: #7ce9dd; }
button { color: inherit; background: #253049ed; border: 1px solid #cad7fb78; border-radius: 9px; font: inherit; cursor: pointer; touch-action: none; user-select: none; }
#inventory { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); max-width: calc(100% - 16px); text-align: center; }
#health { width: min(128px, 100%); margin: 0 0 4px; padding: 3px 7px; border-radius: 6px; background: #272839ed; text-align: left; font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: none; }
#health-bar { display: block; width: 100%; height: 7px; margin-top: 3px; appearance: none; border: 0; border-radius: 4px; overflow: hidden; background: #503a34; }
#health-bar::-webkit-progress-bar { background: #503a34; }
#health-bar::-webkit-progress-value { background: #d67d59; }
#health-bar::-moz-progress-bar { background: #d67d59; }
#hurt-flash { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 58px #b63c29b8; opacity: 0; transition: opacity 160ms ease-out; }
#hurt-flash.visible { opacity: 1; transition: none; }
@media (prefers-reduced-motion: reduce) { #hurt-flash { transition: none; } }
#material-name { display: inline-block; margin-bottom: 5px; padding: 3px 10px; border-radius: 5px; background: #253049ed; font-size: 13px; pointer-events: none; }
#hotbar-row { display: flex; gap: 4px; align-items: center; }
#hotbar { display: flex; gap: 3px; padding: 4px; border-radius: 9px; background: #192237eb; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
#hotbar { min-width: 0; }
#open-backpack, #open-settings { display: grid; flex: 0 0 44px; height: 44px; place-items: center; }
#open-settings { color: #a8e0d9; font-size: 22px; }
.backpack-icon { position: relative; width: 17px; height: 18px; margin-top: 3px; border: 2px solid #a8e0d9; border-radius: 5px 5px 3px 3px; }
.backpack-icon::before, .backpack-icon::after { content: ""; position: absolute; border: 1px solid #a8e0d9; }
.backpack-icon::before { width: 7px; height: 4px; top: -6px; left: 2px; border-radius: 3px 3px 0 0; }
.backpack-icon::after { width: 9px; height: 5px; bottom: 2px; left: 1px; border-radius: 2px; }
.slot { position: relative; display: grid; flex: 0 0 44px; place-items: center; height: 44px; padding: 0; border-radius: 5px; background: #38435d; touch-action: pan-x; }
.slot[aria-pressed="true"] { border: 2px solid #f6d588; background: #62593b; }
.slot-icon { display: block; width: 25px; height: 25px; border-radius: 2px; image-rendering: pixelated; pointer-events: none; }
.torch-icon { background: linear-gradient(#ffca60 45%, #ac7747 45%) center / 5px 21px no-repeat, linear-gradient(#f77d35, #f77d35) center 3px / 11px 9px no-repeat; }
.tool-icon { background: #89aca8; }
.tool-0 { background: linear-gradient(90deg, #7edbd1 18%, #559385 18% 74%, #b89956 74%); clip-path: polygon(5% 24%, 92% 24%, 92% 61%, 58% 61%, 58% 92%, 41% 92%, 41% 61%, 5% 61%); }
.tool-1 { background: linear-gradient(#91b2b9 41%, #b38956 41%); clip-path: polygon(9% 14%, 84% 14%, 84% 39%, 55% 39%, 55% 94%, 40% 94%, 40% 39%, 9% 39%); }
.tool-2 { background: linear-gradient(90deg, #91b2b9 40%, #b38956 40%); clip-path: polygon(2% 27%, 35% 27%, 50% 43%, 96% 43%, 96% 57%, 50% 57%, 35% 73%, 12% 73%, 12% 58%, 33% 58%, 33% 42%, 2% 42%); }
.tool-3 { background: linear-gradient(#73a496 65%, #b38956 65%); clip-path: polygon(12% 10%, 27% 10%, 27% 33%, 73% 33%, 73% 10%, 88% 10%, 88% 46%, 59% 61%, 59% 94%, 41% 94%, 41% 61%, 12% 46%); }
.slot-number { position: absolute; left: 3px; top: 1px; color: #fff9e1; font-size: 10px; text-shadow: 0 1px 2px #17271d; pointer-events: none; }
.slot-count { position: absolute; right: 2px; bottom: 2px; min-width: 15px; padding: 1px 3px; border-radius: 3px; background: #151e31ed; color: #fff2cf; font-size: 11px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; pointer-events: none; }
.slot.empty .slot-icon { opacity: .48; }
.slot.empty .slot-count { color: #c2cbdf; }
#backpack, #supplies, #beacon-menu { color: #f5f1df; width: min(620px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 18px; overflow: auto; overscroll-behavior: contain; background: #192237; border: 1px solid #62738e; border-radius: 14px; box-shadow: 0 14px 46px #0a0e1ba6; }
#beacon-menu { width: min(460px, calc(100% - 24px)); }
#backpack::backdrop, #supplies::backdrop, #beacon-menu::backdrop { background: #090f20ad; }
#close-supplies, #supply-recipes button, #beacon-menu button { min-height: 44px; padding: 6px 10px; touch-action: pan-y; }
.panel-list { display: grid; gap: 8px; margin-top: 12px; }
.panel-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 6px 10px; padding: 10px; border: 1px solid #526581; border-radius: 8px; background: #23314a; }
.panel-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 6px; background: #192237; }
.panel-card strong, .panel-meta { display: block; overflow-wrap: anywhere; }
.panel-meta { margin-top: 3px; color: #c1d1e8; font-size: 12px; line-height: 1.4; }
.recipe-costs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.recipe-cost { padding: 2px 6px; border-radius: 4px; background: #172337; color: #a8e0d9; font-size: 12px; font-variant-numeric: tabular-nums; }
.recipe-cost.short { color: #ffc198; }
#supply-recipes button { grid-column: 2; justify-self: end; max-width: 100%; overflow-wrap: anywhere; }
#supply-recipes button:disabled { opacity: .48; cursor: default; }
.route-card { grid-template-columns: 32px minmax(0, 1fr) 18px; cursor: pointer; }
.route-card:has(:checked) { border-color: #8cdbcf; background: #294458; }
.route-card input { inline-size: 16px; block-size: 16px; margin: 0; accent-color: #8cdbcf; }
.route-orb { width: 30px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 30% 28%, #af98df, #3b345e 76%); }
.route-orb[data-world="LH-02"] { background: radial-gradient(circle at 30% 28%, #e1bb77, #645333 76%); }
.route-orb[data-world="LH-03"] { background: radial-gradient(circle at 30% 28%, #9ad6eb, #263f66 76%); }
@media (min-width: 520px) {
  #supply-recipes .panel-card { grid-template-columns: 40px minmax(0, 1fr) auto; }
  #supply-recipes button { grid-column: 3; }
}
.pack-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid #465872; }
.pack-header h2 { margin: 0; font-size: 21px; }
#backpack-status { margin: 4px 0 0; color: #b8c9e1; font-size: 12px; }
#close-backpack { min-height: 40px; padding: 0 14px; touch-action: pan-y; }
#backpack h3 { margin: 14px 0 7px; color: #a8e0d9; font-size: 13px; }
#pack-scroll { overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
#pack-layout { min-width: calc(var(--pack-columns) * 38px + (var(--pack-columns) - 1) * 5px); }
.pack-grid { display: grid; grid-template-columns: repeat(var(--pack-columns), minmax(0, 1fr)); gap: 5px; }
#pack-belt-title { position: sticky; left: 2px; width: max-content; }
#backpack .slot { height: auto; width: 100%; min-width: 0; aspect-ratio: 1; touch-action: auto; }
.slot.vacant { background: #202a40; border-color: #65738a; }
.slot.held { outline: 2px solid #7ce9dd; outline-offset: -2px; }
#pack-hint { margin: 10px 0 0; color: #b8c9e1; font-size: 12px; }
#pack-gear { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 6px; }
.gear-card { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 8px; }
.gear-card .panel-icon { width: 34px; height: 34px; }
.gear-card button { min-height: 44px; max-width: 8em; padding: 4px 7px; font-size: 12px; overflow-wrap: anywhere; touch-action: pan-y; }
.gear-card[data-active] { border-color: #77afa9; }
.gear-card[data-active] .panel-meta { color: #a8e0d9; }
#settings { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); color: #f5f1df; background: radial-gradient(ellipse at 70% 0%, #294059, #141e32 68%); overflow: auto; color-scheme: dark; }
#settings[open] { display: grid; align-items: safe center; }
.settings-content { width: min(100%, 640px); margin-inline: auto; }
.settings-heading { border-bottom: 1px solid #607595; padding-bottom: 22px; margin-bottom: 16px; }
.settings-heading p { color: #a8e0d9; margin: 0 0 6px; letter-spacing: .08em; }
.settings-heading h1 { font-size: clamp(30px, 6vw, 52px); margin: 0; overflow-wrap: anywhere; }
.settings-options { display: grid; gap: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 10px 14px; border: 1px solid #526581; border-radius: 10px; background: #23314a; font-size: 16px; }
.setting-row[hidden] { display: none; }
#fullscreen-error { flex-basis: 100%; color: #f6d588; font-size: 13px; }
.setting-row :is(select, button) { min-height: 44px; min-width: min(12em, 100%); max-width: 100%; padding: 8px 12px; border: 1px solid #7e93ae; border-radius: 7px; color: inherit; background: #18243a; font: inherit; }
#resume-game { min-height: 48px; margin-top: 20px; padding: 8px 22px; color: #14252d; background: #a8e0d9; font-weight: 700; }
#settings :focus-visible { outline: 2px solid #f6d588; outline-offset: 3px; }
#enter-planet { width: 100%; color: #a8e0d9; }
#planet-travel { margin-top: 7px; }
#planet-travel:not([hidden]) { display: flex; gap: 4px; flex-wrap: wrap; }
#exit-planet, #planet-scale { min-height: 44px; padding: 0 12px; }
#exit-planet, #planet-scale { max-width: 100%; overflow-wrap: anywhere; pointer-events: auto; }
#planet-info { max-width: 100%; padding: 6px 8px; border-radius: 6px; background: #222b43e8; color: #dce7fc; text-align: right; }
#planet-name { margin: 0 0 4px; color: #fff2cf; font-size: 14px; }
#planet-profile { margin: 0; font-size: 12px; white-space: pre-line; overflow-wrap: anywhere; }
#planet-scale { color: inherit; background: #253049ed; border: 1px solid #cad7fb78; border-radius: 9px; font: inherit; color-scheme: dark; }
#planet-guidance { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; border-radius: 8px; padding: 8px 12px; background: #222b43e8; text-align: center; }
#world.planet-target ~ #crosshair, #crosshair.target { color: #ffc16f; }
@media (max-width: 520px) {
  #backpack { padding: 12px; }
}
#help { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); background: #222b43e8; border-radius: 8px; padding: 8px 12px; text-align: center; pointer-events: none; }
#project-watermark { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(3px, env(safe-area-inset-bottom)); padding: 1px 5px; border-radius: 3px; background: #141c30a8; color: #e8eafa; font-size: 10px; line-height: 12px; letter-spacing: .04em; pointer-events: none; user-select: none; }
#touch { --control: 44px; --stick-size: clamp(96px, 29vmin, 124px); --control-bottom: calc(env(safe-area-inset-bottom) + clamp(72px, 17vh, 90px)); display: none; position: absolute; inset: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); pointer-events: none; }
#touch button { width: var(--control); height: var(--control); padding: 2px; font-size: 13px; line-height: 1.1; overflow-wrap: anywhere; pointer-events: auto; }
#touch button:disabled { opacity: .4; pointer-events: none; }
#move-stick { position: absolute; left: 0; bottom: var(--control-bottom); width: var(--stick-size); aspect-ratio: 1; display: grid; place-items: center; border: 2px solid #a8ccdabb; border-radius: 50%; background: radial-gradient(transparent 0 40%, #a8ccdacc 41% 42%, #17283eb3 43%), #142237bb; touch-action: none; pointer-events: auto; }
#move-stick span { width: 36%; aspect-ratio: 1; border: 2px solid #c9f3eb; border-radius: 50%; background: #436878; box-shadow: 0 2px 5px #0a1020a8; pointer-events: none; }
#move-stick.sprinting, #move-stick.sprinting span { border-color: #f6d588; }
.actions { --control: clamp(58px, 17vmin, 74px); position: absolute; right: 0; bottom: var(--control-bottom); display: grid; grid-template-columns: repeat(2, var(--control)); gap: 9px; }
.actions button { position: relative; border-radius: 50%; border: 2px solid currentColor; background: #142237e6; color: #b6f1e7; box-shadow: 0 2px 5px #0a1020a8; }
.actions button:active { background: #416174; }
.actions button::before, .actions button::after { content: ""; position: absolute; inset: 0; margin: auto; pointer-events: none; }
#jump { grid-area: 2 / 2; color: #fff3cf; }
#jump::before, #descend::before { width: 30px; height: 30px; background: currentColor; clip-path: polygon(50% 3%, 97% 48%, 75% 48%, 75% 80%, 25% 80%, 25% 48%, 3% 48%); }
#jump::after { width: 28px; height: 3px; transform: translateY(15px); background: currentColor; border-radius: 2px; }
#descend { grid-area: 2 / 1; }
#descend::before { transform: rotate(180deg); }
#dig { grid-area: 1 / 2; }
#dig::before { width: 30px; height: 30px; border: 3px dashed currentColor; border-radius: 50%; }
#dig::after { width: 10px; height: 10px; border-radius: 2px; background: currentColor; transform: rotate(45deg); }
#dig.attack-control::before { width: 32px; height: 32px; border: 0; border-radius: 0; background: currentColor; clip-path: polygon(96% 4%, 86% 43%, 55% 72%, 69% 86%, 60% 95%, 45% 80%, 24% 99%, 13% 88%, 33% 68%, 18% 53%, 27% 44%, 41% 58%, 72% 26%); }
#dig.attack-control::after { display: none; }
#place { grid-area: 1 / 1; color: #f6d588; transform: translateY(50%); }
#touch.flying #place { transform: none; }
#place::before { width: 31px; height: 34px; background: conic-gradient(from 60deg, #ffe3a4 0 120deg, #bb8344 120deg 240deg, #f6d588 240deg); clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
@media (pointer: coarse) {
  #touch { display: block; }
  #help, .slot-number { display: none; }
  #inventory { --belt-cell: clamp(22px, calc((100dvw - 55px - env(safe-area-inset-left) - env(safe-area-inset-right)) / 10), 44px); bottom: calc(env(safe-area-inset-bottom) + 19px); width: max-content; }
  #hotbar-row { justify-content: center; }
  #hotbar { overflow: visible; }
  #hotbar .slot, #open-backpack, #open-settings { flex-basis: var(--belt-cell); height: var(--belt-cell); }
  #hotbar .slot[hidden] { display: none; }
  #hotbar .slot-icon { width: min(25px, calc(var(--belt-cell) - 8px)); height: min(25px, calc(var(--belt-cell) - 8px)); }
  #hotbar .slot-count { right: 0; bottom: 0; min-width: 0; font-size: 10px; }
  #planet-guidance { bottom: calc(env(safe-area-inset-bottom) + 19px); }
  #project-watermark { position: static; text-align: right; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-width: 740px) {
  #move-stick { bottom: calc(env(safe-area-inset-bottom) + 112px); }
}
