:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
body { min-width: 320px; height: 100dvh; overflow: hidden; overscroll-behavior: none; background: #567052; }
.shell { width: 100%; }
.world-stage, .world-stage #world-map, #player-labels { position: fixed; inset: 0; width: 100%; height: 100%; }
.world-stage #world-map { display: block; max-height: none; aspect-ratio: auto; touch-action: none; cursor: crosshair; outline-offset: -3px; }
.world-stage #world-map.placing { cursor: cell; }
#player-labels { pointer-events: none; overflow: hidden; }
.player-pin { position: absolute; left: 0; top: 0; padding: .2rem .42rem; border: 1px solid #9ca888; border-radius: 4px; background: #243326ec; color: #f7ebcb; white-space: nowrap; font-size: .76rem; font-weight: 700; box-shadow: 0 2px 10px #141d15a0; }
.local-pin { color: #ffe2a2; border-color: #a48b54; }
.webgl-error { position: absolute; inset: 47% 0 auto; margin-inline: auto; width: fit-content; max-width: 65%; padding: .75rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.webgl-error button { margin-top: .55rem; }

.topbar { position: relative; z-index: 2; border: 0; background: linear-gradient(180deg, #162219f5, #18251bae 72%, #17231900); pointer-events: none; }
.topbar-inner { min-height: 62px; padding-inline: 23px; }
.topbar-inner a, .topbar-inner button { pointer-events: auto; }
.topbar .online { color: #e3f1bf; text-shadow: 0 1px 4px #152517; }
.topbar .offline { color: #e1ddd1; }
.top-actions > button { background: #243129ec; }
#sound-toggle { width: 38px; min-height: 38px; display: grid; place-items: center; padding: 0; }
#sound-icon, #share .share-mark { width: 20px; height: 20px; }
#share .share-mark { display: none; }

main.shell { position: fixed; inset: 62px 0 0; width: 100%; padding: 0; z-index: 1; pointer-events: none; animation: world-enter .5s ease-out both; }
body:not(.signed-in) main.shell, body:not(.signed-in) .topbar { visibility: hidden; }
@keyframes world-enter { from { opacity: 0; } to { opacity: 1; } }
.world-heading { position: absolute; top: 10px; left: 23px; right: 23px; align-items: start; }
.world-heading h1 { font-size: clamp(1.75rem, 3.2vw, 2.45rem); letter-spacing: -.045em; text-shadow: 0 2px 12px #1a2719, 0 1px 3px #1a2719; }
.eyebrow, .world-heading .map-info { text-shadow: 0 1px 5px #1a2719, 0 1px 3px #1a2719; }
.world-heading .map-info { color: #f0ecd7; margin-top: 3px; }
.day { margin-top: 2px; background: #202d24eb; }

.stockbar { width: min(55%, 640px); margin: 0 auto; background: #202c24f5; box-shadow: 0 5px 24px #18291955; }
.stockbar.has-iron { width: min(57%, 720px); grid-template-columns: minmax(115px, .95fr) repeat(5, 1fr); }
.item-icon.iron { background: #40362f; border-color: #605143; }
.stock-title, .stock-item { min-height: 53px; padding-inline: .68rem; }
.stock-title { font-size: .82rem; }
.stockbar .item-icon { width: 33px; height: 33px; }
.stockbar small { font-size: .69rem; }
.stockbar strong { font-size: 1.32rem; }

.game-grid { position: absolute; inset: auto 20px 64px; display: grid; grid-template-columns: minmax(175px, 208px) minmax(0, 1fr) minmax(183px, 258px); gap: 13px; align-items: end; }
.game-grid .left-pane, .game-grid .center-pane, .game-grid .right-pane { gap: 9px; }
.game-grid .right-pane { display: grid; grid-column: auto; grid-template-columns: 1fr; }
.game-grid .panel { pointer-events: auto; background: #202b23f5; border-color: #53614a; box-shadow: 0 6px 24px #1426194a; }
.game-grid .panel-heading { min-height: 38px; padding-block: .38rem; }
.game-grid .vitals { gap: .44rem; padding-block: .52rem; }
.game-grid .feed { max-height: 122px; }
.game-grid .quest-art { height: 57px; }
.game-grid .quest-body { padding-block: .54rem .7rem; }
.game-grid .goal-list { margin-block: .5rem; }
.game-grid .construction { width: min(100%, 668px); margin: 0 auto; }
.game-grid .blueprints { grid-template-columns: repeat(auto-fit, minmax(min(105px, 100%), 1fr)); }
.game-grid .blueprint { min-height: 49px; grid-template-columns: 29px minmax(0, 1fr); }
.game-grid .blueprint canvas { width: 29px; height: 29px; }
.game-grid .blueprint small { font-size: .7rem; }

.placing-hint { pointer-events: auto; inset: auto auto 64px 50%; transform: translateX(-50%); width: max-content; max-width: min(94%, 37rem); }
.map-dock { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: .58rem; white-space: nowrap; }
.zoom { display: flex; gap: .22rem; }
.zoom button { min-width: 38px; min-height: 38px; font-size: 1.1rem; line-height: 1; }
.map-dock button { pointer-events: auto; background: #24322aef; }
.control-guide { display: flex; align-items: center; gap: .23rem; background: #1f2c23ed; border: 1px solid #50624d; border-radius: 6px; min-height: 38px; padding: .24rem .44rem; font-size: .75rem; }
.control-guide span { margin-left: .2rem; }
kbd { padding: 2px 4px; min-width: 16px; text-align: center; background: #344235; border-radius: 3px; border-bottom: 1px solid #68785b; color: #f3e0b5; font: 700 .72rem/1.2 var(--sans); }
.mobile-dock { display: none; }
.notice { z-index: 4; bottom: auto; top: 137px; }
.aim-ui { display: none; position: fixed; inset: 0; pointer-events: none; }
.signed-in .aim-ui { display: block; }
.reticle { position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); filter: drop-shadow(0 1px 2px #182318); }
.reticle::before, .reticle::after { content: ''; position: absolute; background: #fff0c6; border-radius: 3px; }
.reticle::before { inset: 8px 0; }
.reticle::after { inset: 0 8px; }
.reticle.confirmed::before, .reticle.confirmed::after { animation: confirmed-hit .3s ease-out; }
@keyframes confirmed-hit { from { background: #f58c73; box-shadow: 0 0 8px #f88d71; } to { background: #fff0c6; box-shadow: none; } }
#aim-hint { position: absolute; top: calc(50% + 18px); left: 50%; transform: translateX(-50%); padding: .32rem .55rem; background: #1d2a22ee; border: 1px solid #687760; border-radius: 5px; white-space: nowrap; font-size: .82rem; }
#animal-health { position: absolute; top: calc(50% + 53px); left: 50%; transform: translateX(-50%); width: 86px; height: 6px; border: 1px solid #38231c; --meter: #e89577; }
.locked #look { display: none; }
.locked .game-grid .left-pane, .locked .game-grid .right-pane, .locked .game-grid .center-pane { visibility: hidden; pointer-events: none; }
.locked .game-grid .panel { pointer-events: none; }
.tool-slots { position: absolute; right: 20px; bottom: 14px; display: flex; gap: .3rem; }
.tool-slot { pointer-events: auto; display: grid; grid-template-columns: 24px auto; align-items: center; text-align: start; gap: .35rem; min-height: 43px; padding: .35rem .48rem; background: #202b23f1; border: 1px solid #53604a; border-radius: 6px; }
.tool-slot[aria-pressed='true'] { border-color: #e4bf7e; background: #48513a; }
.tool-slot:hover { border-color: #c0a573; }
.tool-slot > [data-icon] { width: 27px; height: 27px; }
.tool-slot strong, .tool-slot small { display: block; line-height: 1.14; }
.tool-slot strong { font-size: .86rem; }
.tool-slot small { color: var(--muted); font-size: .67rem; margin-top: 3px; }
.touch-move, .touch-actions { display: none; }
.raid-warning { position: absolute; inset: 97px 0 auto; margin-inline: auto; width: fit-content; padding: .36rem .7rem; color: #ffe0ae; background: #5b372ced; border: 1px solid #bc8565; border-radius: 5px; font-size: .85rem; font-weight: 700; }
.hit-flash { position: fixed; inset: 0; z-index: 3; pointer-events: none; box-shadow: inset 0 0 9rem 1rem #a743328c; opacity: 0; }
.hit-flash.hit { animation: hit .36s ease-out; }
@keyframes hit { from { opacity: 1; } to { opacity: 0; } }
.tutorial-dialog { width: min(385px, calc(100% - 28px)); }
.tutorial-dialog h2 { margin-top: .4rem; }
.tutorial-dialog #tutorial-text { font-size: .94rem; color: #e1dbc8; }
.quick-vitals { position: absolute; left: 20px; bottom: 14px; display: flex; gap: .55rem; padding: .42rem .63rem; background: #222e25f2; border: 1px solid #53604a; border-radius: 6px; }
.quick-vitals span { display: grid; grid-template-columns: 7px auto; align-items: center; gap: 1px 4px; }
.quick-vitals i { width: 6px; height: 6px; border-radius: 2px; background: #d27e73; }
.quick-vitals i.quick-energy { background: #9abd72; }
.quick-vitals i.quick-hunger { background: #cfaa65; }
.quick-vitals b { font-size: .84rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.quick-vitals small { grid-column: 1 / -1; font-size: .68rem; color: var(--muted); }
.game-grid .left-pane, .game-grid .right-pane, .game-grid .construction { display: none; }
.game-grid .left-pane.open, .game-grid .right-pane.open { display: grid; }
.game-grid .right-pane.open { max-height: min(65dvh, 560px); overflow-y: auto; pointer-events: auto; scrollbar-width: thin; }
.game-grid .right-pane.open > .panel { min-height: min-content; }
.game-grid .center-pane { grid-column: 2; }
.game-grid .right-pane { grid-column: 3; }
.game-grid .construction.open { display: block; }
.game-grid .construction .blueprints { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.game-grid .construction.open { max-height: min(53dvh, 440px); overflow-y: auto; scrollbar-width: thin; }
.era-track { display: flex; flex-wrap: wrap; gap: .27rem; margin: .22rem 0 .65rem; padding: 0; list-style: none; }
.era-track li { padding: .17rem .31rem; border: 1px solid #51634f; border-radius: 4px; color: #aeb8a8; font-size: .68rem; }
.era-track li.current { border-color: #ba9a60; background: #493e2c; color: #ffe1a1; }
.era-track li.past { color: #b7d294; }
.research-cost { display: grid; gap: .15rem; margin-top: .48rem; }
.research-cost > div { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: .35rem; color: #cab89f; font-size: .78rem; }
.research-cost > div.met { color: #c8db98; }
.research-cost b { font-variant-numeric: tabular-nums; font-size: .76rem; }
.cost-icon { display: block; width: 16px; height: 16px; }
.cost-icon canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.research { width: 100%; margin-top: .52rem; }
.research:disabled { opacity: .49; }
.quest .power-status { background: #243b34; border: 1px solid #4f6e5c; border-radius: 4px; color: #b3d4a6; padding: .38rem .47rem; margin-top: .59rem; }
.crafting { border-top: 1px solid var(--line); margin-top: .61rem; padding-top: .55rem; }
.crafting h3 { font-size: 1.02rem; }
#craft-options { display: grid; gap: 4px; margin-top: .4rem; }
.craft-option { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: .34rem; text-align: start; padding: .29rem .38rem; }
.craft-option strong, .craft-option small { display: block; }
.craft-option small { color: var(--muted); font-size: .68rem; font-weight: 400; }
.quick-vitals i.quick-armor { background: #91b0a6; }
.mobile-dock { display: flex; gap: .27rem; }
.mobile-dock button[aria-expanded='true'] { background: #465d40; border-color: #a2a87b; }
.locked .mobile-dock { display: none; }
.dialog-actions #logout { margin: 0 auto 0 0; }

.account-dialog { max-height: calc(100dvh - 20px); width: min(415px, calc(100% - 26px)); padding: clamp(1rem, 5vw, 1.65rem); border-color: #70836a; color: #f4ebd4; background: #202b23; box-shadow: 0 18px 80px #0a120eaa; overflow-y: auto; }
.account-dialog::backdrop { background: #141c14a3; backdrop-filter: blur(2px); }
.account-brand { display: flex; align-items: center; gap: .62rem; margin-bottom: .9rem; font: 700 1.28rem/1 var(--display); color: #e8c88c; }
.account-brand img { padding: 4px; object-fit: contain; image-rendering: pixelated; background: #343529; border-radius: 8px; border: 1px solid #68593e; }
.account-dialog h2 { font-size: clamp(1.65rem, 6vw, 2.05rem); margin-bottom: .72rem; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-bottom: .8rem; }
.account-tabs button { min-height: 43px; }
.account-tabs button[aria-pressed='true'] { border-color: #9e8a59; background: #3a4935; color: #ffe3a6; }
.account-dialog input { min-height: 43px; }
.account-dialog label:not(:first-of-type) { margin-top: .57rem; }
#password-help { color: var(--muted); display: block; font-size: .73rem; margin-top: .25rem; }
.captcha { margin-top: .76rem; }
.captcha-top { display: flex; align-items: center; justify-content: space-between; gap: .45rem; min-height: 34px; }
.captcha-top p { font-size: .89rem; }
.captcha-top .text-button { margin: 0; padding: .3rem 0 .3rem .4rem; }
.captcha-row { position: relative; border: 1px solid #718268; border-radius: 5px; overflow: hidden; }
.captcha-row img { display: block; width: 100%; height: 58px; object-fit: fill; }
.captcha-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: absolute; inset: 0; }
.captcha-buttons button { background: transparent; border: 0; border-right: 1px solid #90a17e99; color: inherit; }
.captcha-buttons button:last-child { border-right: 0; }
.captcha-buttons button:hover { background: #fff1be20; }
.captcha-buttons button[aria-pressed='true'] { background: #f1d28a33; box-shadow: 0 0 0 3px #f1d28a inset; }
.captcha-buttons button:focus-visible { outline-offset: -4px; }
.account-dialog .form-error { margin-block: .55rem; }
#account-submit { width: 100%; min-height: 44px; }
#account-submit:disabled { opacity: .52; }

@media (min-width: 861px) and (max-width: 1130px) {
  .topbar-inner { padding-inline: 14px; }
  .world-heading { left: 14px; right: 14px; }
  .world-heading h1 { max-width: 205px; }
  .stockbar { width: min(57%, 590px); grid-template-columns: repeat(4, 1fr); }
  .stockbar.has-iron { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stock-title { display: none; }
  .stock-title + .stock-item { border-left: 0; }
  .game-grid { inset-inline: 13px; gap: 8px; }
}
@media (min-width: 861px) and (max-width: 1250px) {
  .control-guide { display: none; }
}
@media (min-width: 861px) and (max-height: 720px) {
  .game-grid .quest-art { display: none; }
  .game-grid > * { max-height: calc(100dvh - 143px); overflow: auto; scrollbar-width: thin; }
  .game-grid .work .job { padding-block: .2rem; }
}
@media (max-width: 860px) {
  .topbar-inner { min-height: 56px; padding-inline: 12px; }
  main.shell { inset-block-start: 56px; }
  .world-heading { top: 75px; left: 12px; right: 12px; }
  .world-heading h1 { font-size: clamp(1.45rem, 4.7vw, 2.05rem); }
  .eyebrow { margin-bottom: 4px; }
  .stockbar { width: min(calc(100% - 24px), 565px); grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stockbar.has-iron { width: min(calc(100% - 24px), 565px); grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stock-title { display: none; }
  .stock-title + .stock-item { border-left: 0; }
  .stock-item { min-height: 44px; padding-inline: .45rem; }
  .stockbar .item-icon { width: 27px; height: 27px; }
  .day { padding: .35rem .45rem; }
  .game-grid { inset: auto 12px 58px; display: block; }
  .game-grid .left-pane, .game-grid .right-pane { display: none; }
  .game-grid .center-pane { display: block; }
  .game-grid .construction { display: none; }
  .game-grid .right-pane.open, .game-grid .left-pane.open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .game-grid .right-pane.open { grid-template-columns: 1fr; }
  .game-grid .construction.open { display: block; }
  .game-grid .left-pane.open, .game-grid .right-pane.open, .game-grid .construction.open { max-height: min(52dvh, 400px); overflow: auto; pointer-events: auto; }
  .game-grid .right-pane .quest-art { height: 56px; }
  .map-dock { width: max-content; max-width: calc(100% - 16px); bottom: 9px; gap: .38rem; }
  .control-guide { display: none; }
  .mobile-dock { display: flex; gap: .25rem; }
  .mobile-dock button { min-height: 39px; padding-inline: .57rem; }
  .mobile-dock button[aria-expanded='true'] { background: #465d40; border-color: #a2a87b; }
  .placing-hint { bottom: 59px; }
  .notice { top: auto; bottom: 110px; }
  .tool-slots { right: 10px; bottom: 63px; }
  .raid-warning { top: 132px; }
  .quick-vitals { left: 10px; bottom: 63px; }
}
@media (max-width: 430px) {
  .world-heading { top: 60px; }
  .world-heading .map-info { font-size: .69rem; margin-top: 1px; }
  .stock-item { padding-inline: .28rem; }
  .stockbar .item-icon { width: 24px; height: 24px; padding: 3px; }
  .stockbar.has-iron .item-icon { width: 21px; height: 21px; padding: 2px; }
  .stockbar small { font-size: .63rem; }
  .stockbar strong { font-size: 1.06rem; }
  .game-grid .blueprint { grid-template-columns: 1fr; grid-template-rows: 24px auto; }
  .game-grid .blueprint canvas { width: 26px; height: 26px; }
  .game-grid .quest h3 { font-size: 1rem; }
  .zoom button { min-width: 32px; padding-inline: .36rem; }
}
@media (max-width: 360px) {
  .topbar .online { display: none; }
  .tool-slot strong { display: none; }
  .tool-slot { gap: .13rem; }
}
.touch-controls #look, .touch-controls .control-guide { display: none; }
.touch-controls .topbar-inner { min-height: calc(56px + var(--safe-top)); padding: var(--safe-top) max(12px, var(--safe-right)) 0 max(12px, var(--safe-left)); }
.touch-controls main.shell { inset-block-start: calc(56px + var(--safe-top)); }
.touch-controls .top-actions > button { min-height: 44px; }
.touch-controls #sound-toggle { width: 44px; }
.touch-controls .map-dock { bottom: calc(7px + var(--safe-bottom)); }
.touch-controls .mobile-dock button { min-height: 44px; }
.touch-controls .game-grid { bottom: calc(59px + var(--safe-bottom)); }
.touch-controls .touch-move, .touch-controls .touch-actions { display: flex; position: absolute; bottom: calc(109px + var(--safe-bottom)); }
.touch-controls.pane-open .touch-move, .touch-controls.pane-open .touch-actions { display: none; }
.touch-move { left: calc(14px + var(--safe-left)); }
.move-stick {
  display: grid;
  place-items: center;
  width: clamp(82px, 24vw, 106px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  border: 1px solid #b5bb887d;
  background: radial-gradient(circle, #3f533788 29%, #25372ac9 30%, #1c2a23c9 72%);
  box-shadow: inset 0 0 0 5px #16241c38, 0 5px 20px #111c1640;
}
.move-stick.held { border-color: #e1c587; }
#stick-thumb {
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #b8bd89;
  background: #65764fde;
  box-shadow: 0 3px 9px #17231d80, inset 0 0 0 3px #e0d6a01f;
  pointer-events: none;
}
.touch-actions { right: calc(13px + var(--safe-right)); flex-direction: column; align-items: center; gap: 8px; }
.touch-actions button { pointer-events: auto; touch-action: manipulation; user-select: none; }
.touch-actions .touch-level { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 50%; background: #26382cdb; font-size: 1.5rem; }
.touch-actions .touch-use {
  display: grid;
  width: clamp(66px, 20vw, 82px);
  aspect-ratio: 1;
  justify-items: center;
  align-content: center;
  gap: 3px;
  padding: 0;
  border-radius: 50%;
  border-color: #b69c67;
  background: #51492fef;
  box-shadow: 0 4px 18px #15251b58;
  font-size: .73rem;
}
.touch-use [data-icon] { width: 25px; height: 25px; }
.touch-use.ready:not(:disabled) { background: #72613a; border-color: #f0cd84; }
.touch-controls .tool-slots { left: 50%; right: auto; bottom: calc(61px + var(--safe-bottom)); transform: translateX(-50%); }
.touch-controls .tool-slot { grid-template-columns: 21px auto; min-height: 44px; padding-inline: .38rem; }
.touch-controls .tool-slot > [data-icon] { width: 21px; height: 21px; }
.touch-controls .tool-slot strong { font-size: .73rem; }
.touch-controls .tool-slot small { display: none; }
.touch-controls .quick-vitals { bottom: calc(111px + var(--safe-bottom)); left: 50%; right: auto; transform: translateX(-50%); }
.touch-controls .quick-vitals small { display: none; }
.touch-controls.pane-open .quick-vitals, .touch-controls.pane-open .tool-slots { visibility: hidden; }
.touch-controls .placing-hint { bottom: auto; top: 125px; }
.touch-controls .notice { top: auto; bottom: calc(213px + var(--safe-bottom)); }

@media (max-width: 360px) {
  .touch-controls .tool-slot { grid-template-columns: 21px; min-width: 44px; justify-content: center; }
  .touch-controls .tool-slot > span:last-child { display: none; }
  .touch-controls .quick-vitals { font-size: .75rem; gap: .32rem; padding-inline: .33rem; }
}
@media (max-width: 490px) {
  .touch-controls #share { width: 44px; display: grid; place-items: center; padding: 0; }
  .touch-controls #share .share-mark { display: block; }
  .touch-controls #share .share-text { display: none; }
}

@media (orientation: landscape) and (max-height: 510px) {
  .touch-controls .topbar-inner { min-height: calc(50px + var(--safe-top)); }
  .touch-controls main.shell { inset-block-start: calc(50px + var(--safe-top)); }
  .touch-controls .world-heading { top: 5px; left: max(12px, var(--safe-left)); right: max(12px, var(--safe-right)); }
  .touch-controls .world-heading h1 { font-size: 1.35rem; }
  .touch-controls .world-heading .map-info { display: none; }
  .touch-controls .stockbar { width: min(53%, 425px); }
  .touch-controls .stock-title { display: none; }
  .touch-controls .stockbar .item-icon { width: 22px; height: 22px; }
  .touch-controls .stock-item { min-height: 43px; padding-inline: 4px; }
  .touch-controls .touch-move, .touch-controls .touch-actions { bottom: calc(38px + var(--safe-bottom)); }
  .touch-controls .move-stick { width: 84px; }
  .touch-controls .touch-use { width: 66px; }
  .touch-controls .placing-hint { top: 52px; }
  .touch-controls .raid-warning { top: 51px; }
  .touch-controls .notice { top: calc(131px + var(--safe-top)); bottom: auto; }
}
