.app[data-atlas] > :is(.topbar, .bottombar) { display: none; }

.scene.world-mode, .diplomacy-dialog, .scene > #drawer.atlas-panel-page {
  --atlas-ink: #382f24;
  --atlas-muted: #60523f;
  --atlas-red: #963e31;
  --atlas-paper: #f4e7c8;
  --atlas-rule: #7e684d67;
  --atlas-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.74' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23000' filter='url(%23n)' d='M0 0h200v200H0z'/%3E%3C/svg%3E");
  --atlas-margin: clamp(10px, 2.2vw, 36px);
  background: radial-gradient(ellipse at 45% 0%, #454036, #282824 60%, #211f1d);
}

.scene.world-mode {
  --atlas-gap: clamp(10px, 2.1vmin, 25px);
  --atlas-top: max(var(--atlas-gap), var(--game-inset-top, env(safe-area-inset-top, 0px)));
  --atlas-bottom: max(var(--atlas-gap), var(--game-inset-bottom, env(safe-area-inset-bottom, 0px)));
  --atlas-left: max(var(--atlas-gap), var(--game-inset-left, env(safe-area-inset-left, 0px)));
  --atlas-right: max(var(--atlas-gap), var(--game-inset-right, env(safe-area-inset-right, 0px)));
  --hud-offset: calc(var(--atlas-top) + 107px);
  --dock-clearance: calc(var(--atlas-bottom) + 65px);
  padding: var(--atlas-top) var(--atlas-right) var(--atlas-bottom) var(--atlas-left);
}

.world-mode > :is(.scene-shade, .map-tools, #hint) { display: none; }

.atlas-sheet {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 1680px);
  height: 100%;
  margin-inline: auto;
  padding: 0 var(--atlas-margin);
  border: 1px solid #c3aa7d;
  color: var(--atlas-ink);
  background: radial-gradient(ellipse at 50% 42%, #fbf0d5 24%, var(--atlas-paper) 75%, #e3cda0);
  box-shadow: 0 2px #b09b74, 0 4px #514434, 0 18px 36px #100c0990, inset 0 0 30px #9a754426;
  isolation: isolate;
}

.atlas-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--atlas-grain);
  mix-blend-mode: multiply;
  opacity: .19;
  pointer-events: none;
}

.atlas-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding: clamp(12px, 2vh, 25px) 0 clamp(12px, 2vh, 23px);
}

.atlas-title-block { padding-inline-start: 14px; border-inline-start: 2px solid var(--atlas-red); }
.atlas-kicker {
  color: var(--atlas-muted);
  font: 700 clamp(8px, 1.2vw, 10px)/1.15 var(--ui);
  letter-spacing: .19em;
  text-transform: uppercase;
}
.atlas-kicker span { margin-inline: .32em; color: var(--atlas-red); }
.atlas-heading :is(h1, h2) {
  margin: 4px 0 0;
  font: 600 clamp(28px, 5vw, 53px)/1.02 var(--serif);
  letter-spacing: -.045em;
}

.atlas-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px clamp(8px, 1.35vw, 21px); }
.atlas-tool, .atlas-return, .atlas-zoom button, .atlas-annotation button {
  min-height: 42px;
  border: 1px solid transparent;
  font: 700 13px/1.15 var(--ui);
}
.atlas-tool {
  padding: 0 3px;
  background: none;
  color: var(--atlas-ink);
  text-decoration: underline;
  text-decoration-color: var(--atlas-rule);
  text-underline-offset: .28em;
}
.atlas-tool[aria-expanded=true], .atlas-tool:hover { color: var(--atlas-red); text-decoration-color: currentColor; }
.atlas-return {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-color: var(--atlas-red);
  color: var(--atlas-red);
  background: #f8edcf80;
}
.atlas-return:hover { color: #fcf1d4; background: var(--atlas-red); }
.atlas-return svg { width: 16px; height: 16px; }
.atlas-sheet :is(button, a):focus-visible { outline: 2px solid var(--atlas-red); outline-offset: 2px; }

.atlas-frame {
  position: relative;
  min-height: 0;
  padding: 4px;
  border: 1px solid #887049;
  background: #c4ab7d80;
  box-shadow: 0 0 0 2px #f8ebcb, 0 0 0 3px var(--atlas-rule);
}
.atlas-map-window { position: relative; height: 100%; overflow: hidden; border: 1px solid #74654c; }
.atlas-map-window::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: var(--atlas-grain);
  mix-blend-mode: multiply;
  opacity: .17;
  pointer-events: none;
}
.atlas-context {
  position: absolute;
  z-index: 3;
  inline-size: min(244px, calc(100% - 16px));
  max-block-size: calc(100% - 16px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #9c815b #f3e5c4;
  border: 1px solid #887049;
  border-radius: 2px;
  color: var(--atlas-ink);
  color-scheme: light;
  background: radial-gradient(ellipse at 40% 0%, #fbf0d5, var(--atlas-paper) 73%, #e8d4ad);
  box-shadow: 0 0 0 1px #f8ebcb, 0 0 0 2px #887049a1, 0 8px 22px #33291f55;
  isolation: isolate;
}
.atlas-context::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: var(--atlas-grain);
  mix-blend-mode: multiply;
  opacity: .16;
  pointer-events: none;
}
.atlas-context-title {
  display: grid;
  gap: 3px;
  padding: 8px 12px 9px;
  border-bottom: 3px double var(--atlas-rule);
}
.atlas-context-title h2 {
  margin: 0;
  font: 700 19px/1.15 var(--serif);
  letter-spacing: -.02em;
}
.atlas-context-coordinates {
  margin: 0;
  color: var(--atlas-muted);
  font: 600 11px/1.25 var(--ui);
  font-variant-numeric: tabular-nums;
}
.atlas-context-actions { display: grid; padding: 3px 4px 4px; }
.atlas-context-actions > button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-block-size: 44px;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  font: 650 13px/1.2 var(--ui);
  text-align: start;
  overflow-wrap: anywhere;
}
.atlas-context-actions > button + button { border-top: 1px solid var(--atlas-rule); }
.atlas-context-actions > button:first-child { color: var(--atlas-red); }
.atlas-context-actions > button svg { width: 16px; height: 16px; color: var(--atlas-red); }
.atlas-context-actions > button:enabled:is(:hover, :focus-visible) { background: #ead6ae; }
.atlas-context-actions > button:focus-visible { outline-offset: -2px; }
.world-mode #worldMap { position: absolute; background: #acc2bc; }
.world-mode #worldMap .marker {
  padding: 4px 8px;
  border: 1px solid #72624a;
  border-radius: 2px;
  color: var(--atlas-ink);
  background: #f8edcf;
  box-shadow: 0 1px 3px #382f244d;
  font: 700 12px/1.2 var(--serif);
  white-space: nowrap;
}
.world-mode #worldMap .marker.own { border-color: var(--atlas-red); color: #7f3228; }
.world-mode #worldMap .marker:hover { background: #fff6df; }
.world-mode #worldMap .settlement-site-marker {
  width: 23px;
  height: 23px;
  border: 2px solid var(--atlas-red);
  border-radius: 50%;
  background: #f5e4bdb3;
  box-shadow: 0 0 0 4px #f5e4bd94;
  pointer-events: none;
}
#worldMap.settlement-picking .maplibregl-canvas { cursor: crosshair !important; }
#worldMap.settlement-picking .maplibregl-marker { pointer-events: none; }
#worldMap.settlement-picking .airship-map-button { pointer-events: none; }

.maplibregl-marker.airship-map-marker {
  --airship-ink: #543977;
  --airship-width: 47px;
  --airship-paper: #f8edcf;
  pointer-events: none;
}
.airship-map-button {
  display: grid;
  place-items: center;
  width: var(--airship-width);
  height: 34px;
  padding: 3px;
  border: 1px solid var(--airship-ink);
  border-radius: 999px;
  color: var(--airship-ink);
  background: var(--airship-paper);
  box-shadow: 0 1px 3px #382f2452;
  pointer-events: auto;
  cursor: pointer;
}
.airship-map-button svg { width: 25px; height: 22px; }
.airship-map-button img { width: 100%; height: 26px; object-fit: contain; }
.airship-map-button:is(:hover,:focus-visible,[aria-expanded=true]) { background: #fff6df; }
.airship-map-details {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  display: none;
  gap: 2px;
  width: max-content;
  max-width: min(228px,65vw);
  padding: 6px 8px;
  transform: translateX(-50%);
  border: 1px solid var(--airship-ink);
  border-radius: 2px;
  color: var(--atlas-ink);
  background: var(--airship-paper);
  box-shadow: 0 2px 4px #382f244d;
  font: 600 11px/1.25 var(--ui);
  overflow-wrap: anywhere;
}
.airship-map-details strong { color: var(--airship-ink); }
.airship-map-button[aria-expanded=true] + .airship-map-details { display: grid; }
.airship-map-marker:focus-within { z-index: 1; }
@media (hover: hover) {
  .airship-map-button:hover + .airship-map-details { display: grid; }
  .airship-map-marker:hover { z-index: 1; }
}
@media (pointer: coarse) {
  .airship-map-button { width: max(44px,var(--airship-width)); height: 44px; }
}

.atlas-compass {
  position: absolute;
  z-index: 2;
  inset: 13px 13px auto auto;
  width: clamp(63px, 10vmin, 104px);
  height: auto;
  color: #4e4230;
  filter: drop-shadow(0 0 2px #fff0c0ae);
  pointer-events: none;
  font: 700 10px var(--serif);
}
.atlas-zoom {
  display: flex;
  position: absolute;
  z-index: 2;
  inset: auto 13px 13px auto;
  border: 1px solid #826c4c;
  color: var(--atlas-ink);
  background: #f6e9cb;
  box-shadow: 0 2px 7px #3d331e38;
}
.atlas-zoom button { width: 44px; min-height: 44px; background: none; font: 600 24px/1 var(--serif); }
.atlas-zoom button + button { border-inline-start-color: var(--atlas-rule); }
.atlas-zoom button:enabled:hover, .atlas-annotation button:hover { background: #e6d2a8; }
.atlas-status, .atlas-annotation {
  position: absolute;
  z-index: 2;
  border: 1px solid var(--atlas-rule);
  color: var(--atlas-ink);
  background: #f5e7c6;
  box-shadow: 0 3px 12px #392e2340;
}
.atlas-status { inset: 50% auto auto 50%; transform: translate(-50%, -50%); padding: 12px 18px; text-align: center; }
.atlas-status p { margin: 0; }
.atlas-annotation button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 6px; background: none; }
.atlas-annotation button svg { width: 16px; height: 16px; }
.atlas-annotation button[aria-pressed=true] { color: #812f23; background: #e6d2a8; }
.atlas-site {
  inset: 13px auto auto 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  max-width: calc(100% - 26px);
  padding-inline-start: 10px;
}
.atlas-site button, #clearSelectedShip { min-width: 42px; }
.atlas-frame .world-ship-actions {
  inset: auto auto 13px 13px;
  display: grid;
  grid-template-columns: auto auto auto;
  max-width: calc(100% - 119px);
  padding: 2px;
}
.world-ship-commands { grid-column: 1 / -1; padding: 0 6px 4px; color: var(--atlas-muted); font-size: 11px; }
.world-ship-commands span + span { display: none; }
@media (pointer: coarse) {
  .world-ship-commands span:first-child { display: none; }
  .world-ship-commands span + span { display: inline; }
}

.atlas-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 5px 14px;
  padding-block: 12px;
  color: var(--atlas-muted);
  font-size: 11px;
}
.atlas-legend, .atlas-measure { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.atlas-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.atlas-legend i { width: 7px; height: 7px; border-radius: 50%; background: #5c5140; }
.atlas-legend .atlas-own-dot { background: var(--atlas-red); }
.atlas-gesture-hint { font-size: 10px; }
.atlas-gesture-hint span + span { display: none; }
@media (pointer: coarse) {
  .atlas-gesture-hint span:first-child { display: none; }
  .atlas-gesture-hint span + span { display: inline; }
}
.atlas-measure { justify-content: end; font-variant-numeric: tabular-nums; }
.atlas-scale { flex: none; min-width: 70px; text-align: center; }
.atlas-scale::after { content: ""; display: block; width: 70px; height: 5px; border: solid currentColor; border-width: 0 1px 1px; }
.atlas-credits { text-align: center; font-size: 10px; line-height: 1.3; }
.atlas-credits a { color: inherit; text-underline-offset: 2px; white-space: nowrap; }

.world-mode > .drawer:not(.atlas-panel-page) {
  inset: calc(var(--hud-offset) + 11px) max(calc(var(--atlas-right) + var(--atlas-margin) + 13px), calc((100% - 1680px) / 2 + var(--atlas-margin) + 13px)) auto auto;
  width: min(390px, calc(100% - var(--atlas-left) - var(--atlas-right) - var(--atlas-margin) * 2 - 26px));
  max-height: calc(100% - var(--hud-offset) - var(--dock-clearance) - 11px);
}

.world-mode > #drawer[data-panel=settlements] {
  --ink: var(--atlas-ink);
  --muted: var(--atlas-muted);
  --line: var(--atlas-rule);
  --trim: var(--atlas-rule);
  width: min(434px, calc(100% - var(--atlas-left) - var(--atlas-right) - var(--atlas-margin) * 2 - 26px));
  border: 1px solid #887049;
  border-radius: 2px;
  color: var(--atlas-ink);
  color-scheme: light;
  background: radial-gradient(ellipse at 45% 18%, #fbf0d5, var(--atlas-paper) 70%, #e5cfa4);
  box-shadow: 0 0 0 2px #f8ebcb, 0 0 0 3px #887049a1, 0 9px 22px #33291f55;
  isolation: isolate;
}

.world-mode > #drawer[data-panel=settlements]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--atlas-grain);
  mix-blend-mode: multiply;
  opacity: .16;
  pointer-events: none;
}

.world-mode #drawer[data-panel=settlements] .drawer-head {
  min-height: 54px;
  padding: 4px 8px 4px clamp(11px, 1.6vw, 17px);
  border-bottom: 3px double var(--atlas-rule);
  background: #f0dfba85;
}
.world-mode #drawer[data-panel=settlements] .drawer-head h2 {
  font: 650 clamp(23px, 3vw, 31px)/1.08 var(--serif);
  letter-spacing: -.035em;
}
.world-mode #drawer[data-panel=settlements] .drawer-icon {
  border-color: var(--atlas-red);
  border-radius: 50%;
  color: var(--atlas-red);
  background: #f9edcf;
}
.world-mode #drawer[data-panel=settlements] .drawer-head .icon-button {
  width: 44px;
  min-height: 44px;
  border-radius: 2px;
  color: var(--atlas-red);
}
.world-mode #drawer[data-panel=settlements] .drawer-head .icon-button svg { color: inherit; }
.world-mode #drawer[data-panel=settlements] .drawer-head .icon-button:hover { background: #e9d4ad; }
.world-mode #drawer[data-panel=settlements] .drawer-body {
  padding: clamp(10px, 1.3vw, 15px);
  scrollbar-color: #9c815b #f3e5c4;
}
.world-mode #drawer[data-panel=settlements] :is(button, input, select, summary, a):focus-visible {
  outline: 2px solid var(--atlas-red);
  outline-offset: -2px;
}
.world-mode > .scene-notices { top: calc(var(--hud-offset) + 13px); }

@media (max-width: 760px) {
  .atlas-footer { grid-template-columns: 1fr auto; padding-block: 9px; }
  .atlas-credits { grid-area: 2 / 1 / 3 / -1; text-align: start; }
  #atlasCoordinates { display: none; }
}
@media (max-width: 510px) {
  .scene.world-mode { --hud-offset: calc(var(--atlas-top) + 115px); }
  .atlas-heading { flex-wrap: wrap; gap: 5px 0; padding-block: 11px 5px; }
  .atlas-nav { width: 100%; justify-content: start; }
  .atlas-return { margin-inline-start: auto; padding-inline: 6px; gap: 4px; }
  .atlas-tool, .atlas-return { font-size: 12px; }
  .atlas-title-block { padding-inline-start: 9px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .scene.world-mode { --atlas-gap: 7px; --hud-offset: calc(var(--atlas-top) + 61px); --dock-clearance: calc(var(--atlas-bottom) + 42px); }
  .atlas-heading { padding-block: 6px; }
  .atlas-heading :is(h1, h2) { font-size: clamp(25px, 4vw, 35px); }
  .atlas-footer { padding-block: 5px; }
  .atlas-compass { inset: 9px 9px auto auto; width: 58px; }
}
