.local-world {
  position: absolute;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  background: #24251e;
}

#local-static, #local-map, #local-daylight, #local-annotations {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#local-static {
  pointer-events: none;
  overflow: hidden;
}

.local-ground-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.local-static-plane {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: 0 0;
  will-change: transform;
}

.local-static-plane > div, .local-static-plane canvas {
  position: absolute;
  inset: 0 auto auto 0;
}

#local-map { outline: 0; }
.world:has(#local-map:focus-visible) #local-hud-camera:not(:disabled) #local-hud-camera-label { text-decoration: underline; text-underline-offset: .22em; }
#local-map[data-following="false"] { touch-action: none; }
#local-map[data-panning] { cursor: grabbing; }
#local-daylight { z-index: 1; mix-blend-mode: multiply; pointer-events: none; }
#local-annotations { z-index: 2; pointer-events: none; }

.local-load {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: min(330px, calc(100% - 32px));
  padding: 12px 16px;
  color: #f0e1c8;
  text-align: center;
}

.local-load .map-key { margin-top: 8px; }
.local-load progress { display: block; width: min(220px, 65vw); margin-top: 9px; accent-color: #c3a166; }

.local-hud {
  --wound-line: #bd796f;
  --wound-light: #f2afa1;
  --hero-action-height: 1.65rem;
  container-type: inline-size;
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px 11px;
  pointer-events: auto;
  filter: drop-shadow(0 2px 4px #17120f80);
}
.local-hud::before { border-width: 10px; }

.local-hud-character {
  display: grid;
  grid-template-columns: 3.05rem minmax(0, 1fr);
  column-gap: 11px;
  align-items: center;
}

.local-hud-portrait {
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: url("/art/map/focus-squad.png") center / 55% no-repeat;
  transition: filter 150ms ease;
}
.local-hud-portrait:not(:disabled):is(:hover, :focus-visible) {
  filter: drop-shadow(0 0 3px #d8b5769c);
}

.local-hud-identity { display: grid; gap: 3px; min-width: 0; }
.hud-connection { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.squad-status { color: #ecddbf; font-size: .9rem; overflow-wrap: anywhere; }
.local-hud-title { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-width: 0; }
.local-hud-title h2 { color: #f0e6d5; font-size: 1.16rem; font-weight: 400; line-height: 1.14; }
.local-hud-title h2, #local-hud-motion, .hero-route p, #eta-label, .local-hud-weapon-data p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.local-hud-eye {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: end;
  gap: 6px;
  min-height: 1.5rem;
  padding: 0 3px;
  border: 0;
  border-radius: 1em;
  background: transparent;
  color: #c8c4b9;
  font-size: .75rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 150ms ease, text-shadow 150ms ease;
}
.local-hud-eye:is(:hover, :focus-visible, [aria-expanded="true"]) {
  color: #e9e4da;
  text-shadow: 0 0 8px #d5cdb45c;
}
.local-hud-eye:focus-visible { outline-offset: 1px; }
.local-hud-eye:is(:hover, :focus-visible, [aria-expanded="true"]) .eye-mark { filter: drop-shadow(0 0 3px #d5cdb46b); }
#local-hud-noticeability-text { min-width: 2.85em; text-align: start; }
.eye-mark {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 72% 0;
  transform: rotate(45deg);
}
.eye-mark::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.hero-orders {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "movement stop";
  min-height: calc(max(2.1rem, var(--hero-action-height)) + 5px);
  align-items: center;
  column-gap: 4px;
  padding-block-start: 4px;
  border-block-start: 1px solid #77747140;
}
#local-hud-motion { grid-area: movement; color: var(--muted); font-size: .79rem; white-space: normal; }
#order-buttons, #local-hud-halt { grid-area: stop; }
.hero-route {
  grid-area: route;
  position: relative;
  display: grid;
  grid-template-rows: auto 1rem;
  align-items: baseline;
  min-width: 0;
  padding-block-end: 4px;
  font-size: .76rem;
}
.hero-orders[data-journey="true"] { grid-template-areas: "route stop"; }
.hero-route p { color: var(--moss-light); white-space: normal; line-height: 1.15; }
.journey {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
}
.journey strong { color: #e8c792; font-variant-numeric: tabular-nums; }
.route-coordinate { color: #bdd0c4; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-route progress {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 4px;
  color-scheme: dark;
  accent-color: var(--moss-line);
}
.hero-orders[data-phase="local"] {
  grid-template-areas: "movement stop";
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(var(--hero-action-height), auto);
  min-height: 0;
}
@container (max-width: 230px) {
  #eta-label {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
  }
}
#local-hud-motion[data-moving="true"] { color: var(--moss-light); }
.hero-command {
  height: var(--hero-action-height);
  padding: 0 3px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #e3cea7;
  font-size: .75rem;
  line-height: 1.1;
}
.hero-command:not(:disabled, [aria-disabled="true"]):is(:hover, :focus-visible) {
  color: var(--steel-blue-light);
  text-shadow: 0 0 8px #9dbcc960;
}
.hero-command:focus-visible { outline: 1px solid var(--steel-blue); outline-offset: -2px; }
.hero-command:is(:disabled, [aria-disabled="true"]) { color: #a89d8c; cursor: default; }
#local-hud-halt { inline-size: 6.3em; text-align: end; }
#stop-movement { min-width: 44px; }
.local-hud-help {
  position: absolute;
  z-index: 1;
  inset: auto auto calc(100% + 6px) 0;
  width: min(17rem, calc(100vw - var(--left) - var(--right) - 12px));
  padding: 10px 13px;
  color: #e0d4c0;
  line-height: 1.35;
  font-size: .82rem;
}
.local-hud-help h3 { color: var(--moss-light); font-size: .91rem; font-weight: 400; margin-block-end: 4px; }
.local-hud-vitals { min-height: calc(.77rem * 1.25 + 10px); }
.local-hud-health-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 5px;
  color: #e0ccbc;
  font-size: .77rem;
  line-height: 1.25;
}
.local-hud-health-caption span {
  flex: none;
  color: #b8d1a2;
  color: color-mix(in oklch shorter hue, #ff544f, #b8d1a2 var(--health-ratio, 100%));
  font-variant-numeric: tabular-nums;
  transition: color 170ms ease-out;
}

#local-hud-health {
  appearance: none;
  display: block;
  width: 100%;
  height: 7px;
  margin-block-start: 3px;
  border: 1px solid #8b584e;
  border-radius: 2px;
  background: #231919;
}
#local-hud-health::-webkit-meter-bar {
  border: 0;
  border-radius: 1px;
  background: #231919;
}
#local-hud-health::-webkit-meter-optimum-value {
  border-radius: 1px;
  background: linear-gradient(#ce887a, #974f48);
}
#local-hud-health::-moz-meter-bar {
  border-radius: 1px;
  background: var(--wound-line);
}

.local-hud-hunger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  margin-block-start: 3px;
  color: #e0ccbc;
  font-size: .77rem;
  line-height: 1.25;
}
#local-hud-hunger {
  appearance: none;
  display: block;
  width: 100%;
  height: 5px;
  margin-block-start: 3px;
  border: 1px solid #82694b;
  border-radius: 2px;
  background: #231e16;
}
#local-hud-hunger::-webkit-meter-bar { border: 0; border-radius: 1px; background: #231e16; }
#local-hud-hunger::-webkit-meter-optimum-value { border-radius: 1px; background: #ceab70; }
#local-hud-hunger::-moz-meter-bar { border-radius: 1px; background: #ceab70; }
#local-hud-eat {
  min-width: 44px;
  min-height: 28px;
  height: auto;
  text-align: end;
  white-space: nowrap;
}
#local-hud-meal-price { display: flex; align-items: center; justify-content: end; gap: 3px; color: var(--muted); font-size: .66rem; }
#local-hud-meal-price::before {
  content: "";
  width: 12px;
  height: 12px;
  background: url("/art/provisions.png") center / contain no-repeat;
}

.local-hud-weapon {
  padding-block-start: 2px;
  display: grid;
  gap: 3px 9px;
  align-items: center;
}
.local-hud-weapon-data {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  grid-template-rows: 1.17rem 1rem;
  align-items: baseline;
  column-gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: .75rem;
}
.local-hud-weapon-name { color: var(--data); font-size: .91rem; line-height: 1.17; }
.local-hud-weapon-ammo { grid-column: 1 / -1; font-variant-numeric: tabular-nums; }
.local-hud-weapon-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: var(--hero-action-height);
  column-gap: 4px;
  align-items: center;
}
#local-map[data-mode="combat"] { cursor: url("/art/map/combat-cursor-v1.png") 19 19, crosshair; }
.hud-character-stack { position: relative; }
.local-mode-button {
  position: absolute;
  z-index: 1;
  inset-inline-start: calc(100% + 8px);
  inset-block-end: 10px;
  inline-size: 46px;
  block-size: 46px;
  display: grid;
  place-items: center;
  isolation: isolate;
  border: 1px solid #b39d6c;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #62625b, #383b35 61%, #27241d 74%);
  box-shadow: inset 0 0 0 2px #242119, inset 0 0 0 3px #a2865566, 0 2px 4px #17130eba;
  filter: drop-shadow(0 2px 2px #17130eba);
  pointer-events: auto;
  cursor: pointer;
}
.local-mode-button::before, .local-mode-button::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.local-mode-button::before {
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #a65746d9, #72382ddb 61%, #371e1dea);
  opacity: 0;
  transition: opacity 260ms;
}
.local-mode-button::after {
  inset: 12%;
  background: radial-gradient(ellipse, #ffe3b44c, #ffc98716 55%, transparent 73%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 180ms ease-out;
}
.local-mode-button img {
  position: absolute;
  z-index: 1;
  inline-size: 74%;
  block-size: 74%;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px #100e0b);
  transform: translateY(var(--mode-lift, 0px)) rotate(var(--mode-angle, 0deg)) scale(var(--mode-scale, 1));
  transition: opacity 180ms ease-out, transform 285ms cubic-bezier(.22,.72,.22,1);
}
.local-mode-combat { opacity: 0; --mode-angle: -20deg; --mode-scale: .78; }
.local-mode-button[aria-pressed="true"] { border-color: #d1a076; }
.local-mode-button[aria-pressed="true"]::before { opacity: 1; }
.local-mode-button[aria-pressed="true"] .local-mode-travel { opacity: 0; --mode-angle: 32deg; --mode-scale: .78; }
.local-mode-button[aria-pressed="true"] .local-mode-combat { opacity: 1; --mode-angle: 0deg; --mode-scale: 1; }
.local-mode-button[aria-disabled="false"]:is(:hover, :focus-visible) { --mode-lift: -1px; }
.local-mode-button[aria-disabled="false"]:hover::after { opacity: 1; }
.local-mode-button:focus-visible {
  outline: 0;
  filter: drop-shadow(0 0 2px var(--steel-blue-light)) drop-shadow(0 2px 2px #17130eba);
}
.local-mode-button[aria-disabled="false"]:active { --mode-lift: 1px; }
.local-mode-button[aria-disabled="true"] { opacity: .62; cursor: default; }
.local-cover-status {
  position: absolute;
  inset-inline-start: calc(100% + 8px);
  inset-block-end: 62px;
  line-height: 0;
  filter: drop-shadow(0 1px 1px #161511);
  pointer-events: none;
}
.local-cover-status img { display: block; object-fit: cover; object-position: center top; }
.local-cover-status[data-state="lost"] img { object-position: center bottom; }
@media (max-width: 579px) {
  .local-mode-button { inset-inline-start: auto; inset-inline-end: 0; inset-block-end: calc(100% + 10px); }
  .local-cover-status {
    inset-inline-start: auto;
    inset-inline-end: 54px;
    inset-block-end: calc(100% + 14px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .local-mode-button::before, .local-mode-button::after, .local-mode-button img { transition: none; }
  .local-mode-button[aria-disabled="false"]:is(:hover, :focus-visible, :active) { --mode-lift: 0px; }
}
#local-hud-camera:disabled kbd { display: none; }
@container (min-width: 236px) {
  .local-hud-weapon { grid-template-columns: minmax(0, 1fr) 6.8rem; }
  .local-hud-weapon-actions {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, var(--hero-action-height));
  }
  .local-hud-weapon-actions .hero-command { text-align: end; }
}
.local-hud-status {
  position: relative;
  padding: 7px 10px;
  color: #e5d7c0;
  font-size: .81rem;
  overflow-wrap: anywhere;
}
.local-hud-status:empty { display: none; }
.local-camera-controls {
  display: grid;
  gap: 2px;
  max-width: 100%;
}
.local-camera-action {
  display: inline-flex;
  align-items: center;
  justify-content: start;
  gap: 8px;
  min-height: 32px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #edddbd;
  text-shadow: inherit;
  text-align: start;
  font-size: .76rem;
  line-height: 1.18;
  pointer-events: auto;
}
.local-camera-action[data-following="false"] { color: var(--moss-light); }
.local-camera-action:is(:hover, :focus-visible) { color: var(--steel-blue-light); }
.local-camera-action:focus-visible { outline: 0; text-decoration: underline; text-underline-offset: .22em; }
.local-camera-action kbd {
  color: var(--muted);
  font: inherit;
  font-size: .67rem;
}
.local-camera-help { font-size: .7rem; color: var(--moss-light); overflow-wrap: anywhere; }
.local-camera-help span:nth-child(2) { display: none; }

.local-target {
  --target-top: max(var(--sheet-top), calc(var(--map-tools-bottom, 0px) + 7px));
  position: absolute;
  z-index: 3;
  inset: var(--target-top) var(--right) auto auto;
  width: min(374px, calc(100% - var(--left) - var(--right) - 58px));
  max-height: min(62dvh, calc(100dvh - var(--target-top) - max(0px, var(--right-dock-height, 5rem)) - 6px));
  display: flex;
  flex-direction: column;
  padding: 10px;
  color: var(--steel-blue-light);
  overflow-wrap: anywhere;
  filter: drop-shadow(0 4px 6px #17120fb0);
  animation: local-target-in 165ms ease-out both;
}
@keyframes local-target-in { from { opacity: 0; transform: translateX(8px); } }
.local-target .object-kind { top: -3px; }
.local-target-heading { display: flex; flex: none; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 5px 7px 14px; }
.local-target-heading > div { min-width: 0; padding-top: 29px; }
.local-target-heading h2 { color: #f0e6d5; font-size: 1.45rem; font-weight: 400; line-height: 1.08; }
#local-target-description { margin-top: 6px; color: #d7cbb8; font-size: .9rem; line-height: 1.28; }
.local-target-heading .character-portrait { flex: 0 0 58px; }
#local-target-preview { width: 84px; height: 84px; flex: none; border: 1px solid #918674; background: #292a26; }
.local-target-details {
  min-height: 0; padding: 5px 12px 9px; overflow-y: auto; overscroll-behavior: contain;
  color: #241d16; background: linear-gradient(#f0dcad86, #e9d2a984), var(--paper) url("/art/paper.jpg") center 46% / cover;
  scrollbar-color: #8d7050 var(--paper); scrollbar-width: thin;
}
.local-target-details .route-table > div:has(dd:empty), #local-target-status:empty { display: none; }
.local-target[data-relation="guild"] #local-target-relation { color: #334528; }
.local-target:is([data-relation="own"], [data-relation="squad"], [data-relation="guild"]) #local-target-relation::before {
  content: ""; display: inline-block; width: .58em; height: .58em; margin-inline-end: .35em;
  background: var(--party-color); border: 1px solid var(--map-outline);
}
.local-target[data-relation="guild"] #local-target-relation::before { background: var(--guild); }
.local-target[data-relation="enemy"] #local-target-relation, #local-target-status { color: #763326; }
#local-target-status { margin-top: 5px; font-size: .83rem; }
#local-target-close { width: 44px; min-height: 36px; padding: 0; line-height: 1; font-size: 1.23rem; }
.local-target-tools {
  position: absolute;
  inset: 10px calc(100% - 1px) auto auto;
  display: grid; gap: 4px; padding: 5px;
}
.local-target-tools:not(:has(button:not([hidden]))) { display: none; }
.local-target .order-key[aria-disabled="true"] {
  color: #cfbea3;
  border-color: #6b6254;
  background: #38342d;
  box-shadow: none;
  cursor: default;
}

@media (pointer: coarse) {
  .local-hud { --hero-action-height: 44px; }
  .local-hud-character { grid-template-columns: max(44px, 2.85rem) minmax(0, 1fr); }
  .local-hud-eye, .local-camera-action, #local-target-close, .local-target .order-key { min-height: 44px; }
  #local-hud-eat { min-height: 44px; }
  #local-hud-camera kbd { display: none; }
  .local-camera-help span:first-child { display: none; }
  .local-camera-help span:nth-child(2) { display: inline; }
}

@media (max-width: 579px) {
  .local-target { --target-top: calc(var(--view-stack-bottom, var(--sheet-top)) + 7px); width: min(320px, 74%); }
  .local-target-heading { gap: 9px; }
  .local-target-heading h2 { font-size: 1.25rem; }
  #local-target-preview { width: 64px; height: 64px; }
  .local-target-heading .character-portrait { flex-basis: 48px; }
  .local-hud { padding: 8px; }
  .local-hud-character { grid-template-columns: 44px minmax(0, 1fr); column-gap: 8px; }
  .local-hud-title h2 { font-size: 1rem; }
  .local-hud-eye { gap: 4px; padding-inline: 1px; }
  .hero-command { font-size: .72rem; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .local-target { --target-top: max(calc(var(--top) + 60px), calc(var(--map-tools-bottom, 0px) + 6px)); }
  .local-target .object-kind { width: 100px; height: 26px; padding-bottom: 3px; font-size: .66rem; }
  .local-target-heading { align-items: center; padding: 2px 5px 4px; }
  .local-target-heading > div { padding-top: 14px; }
  .local-target-heading h2 { font-size: 1.08rem; }
  #local-target-description { margin-top: 2px; font-size: .8rem; line-height: 1.12; }
  .local-target-heading .character-portrait { flex-basis: 40px; }
  #local-target-preview { width: 52px; height: 52px; }
  .local-target-details { max-height: 22dvh; padding-block: 1px 3px; }
}

.local-exit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  padding: 8px 14px;
  pointer-events: auto;
  filter: drop-shadow(0 3px 6px #17120f8a);
}

.local-exit h2 { margin-inline-end: auto; color: var(--steel-blue-light); font-size: 1rem; font-weight: 400; }
#local-exit-sides { display: flex; flex-wrap: wrap; gap: 5px; }
.local-exit button { min-height: 36px; font-size: .84rem; }
#local-controls { display: none; }

.local-visit #viewport { visibility: hidden; }
.local-visit #local-controls { display: block; }
.local-visit :is(#hud-info, #sector-grid-toggle, #global-controls,
  .map-place-picker, #fit-map, #zoom-in, #zoom-out) { display: none; }
