/* Карта района */
body.in-atlas {
  --atlas-ink: #151c18;
  --atlas-text: #f1e7cc;
  --atlas-subtle: #b4b9a4;
  --atlas-gold: #e4bb74;
  --atlas-rule: #685c43;
}
html body.in-atlas .global-hud {
  flex-shrink: 0;
  max-width: 910px !important;
  margin-bottom: 6px !important;
}
html body #screenMap.atlas-screen:not(.hidden) {
  align-items: stretch;
  width: 100%;
  max-width: 910px;
  height: auto !important;
  min-height: 0;
  overflow-y: auto !important;
  padding-bottom: max(5px, env(safe-area-inset-bottom));
  color: var(--atlas-text);
}
.atlas-screen [hidden] { display: none !important; }
.atlas-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 55px;
  margin: 0 0 8px;
  padding: 2px 0 8px;
  border-bottom: 1px solid #6f634144;
}
.atlas-back, .atlas-control, .atlas-action-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #8d7b545c;
  border-radius: 7px;
  background: #1a231d;
  color: var(--atlas-text);
  box-shadow: none;
  font: 700 12px/1.2 Interface, system-ui, sans-serif;
  cursor: pointer;
}
.atlas-back {
  width: 40px;
  height: 40px;
  padding: 0 0 4px;
  font: 400 32px/32px system-ui, sans-serif;
}
.atlas-header button:hover, .atlas-control:hover, .atlas-action-menu button:hover { background: #30362a; }
.atlas-heading { min-width: 0; }
.atlas-heading h1 {
  margin: 0;
  color: #eee6cf;
  font: 400 clamp(25px, 6.5vw, 36px)/1.04 Display, Georgia, serif;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.atlas-heading span {
  display: block;
  margin-top: 4px;
  color: var(--atlas-gold);
  font: 700 10px/1.15 Interface, system-ui, sans-serif;
}
.atlas-locate { gap: 7px; }
.atlas-locate::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dbbf83;
  outline: 1px solid #dbbf838a;
  outline-offset: 2px;
}

.atlas-layout { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.atlas-main { min-width: 0; }
.atlas-frame {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  height: min(calc(100dvh - 274px), calc((100vw - 20px) * 4 / 3));
  min-height: 306px;
  overflow: hidden;
  margin-inline: auto;
  border: 1px solid #9a835a;
  border-radius: 9px;
  background: #333c2e;
  box-shadow: 0 12px 26px #03080595;
}
.atlas-surface {
  position: absolute;
  inset: 0;
  background: url('images/bg_world_atlas.webp') center / 100% 100% no-repeat;
}
.atlas-surface::before, .atlas-surface::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.atlas-surface::before {
  background: linear-gradient(152deg, #0e211b08, #15201620 53%, #10191258),
    radial-gradient(ellipse at 50% 42%, transparent 33%, #08181150 100%);
}
.atlas-surface::after {
  z-index: 2;
  inset: 5px;
  border: 1px solid #d9c88959;
  border-radius: 5px;
  background-image: linear-gradient(to right, #f9e7b81a 1px, transparent 1px),
    linear-gradient(to bottom, #f9e7b81a 1px, transparent 1px);
  background-size: 20% 16.667%;
  opacity: .64;
}
.atlas-district .atlas-surface {
  background-size: 300% 300%;
  background-position: var(--atlas-x, 50%) var(--atlas-y, 50%);
}
.atlas-district .atlas-surface::before {
  background: linear-gradient(150deg, #10221ed0, #071c179c 60%, #111b15df),
    radial-gradient(ellipse at center, transparent 55%, #07110cd0 100%);
}
.atlas-roads, .atlas-pins {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
}
.atlas-roads { pointer-events: none; }
.atlas-roads path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.atlas-road-open {
  stroke: #e6bf7d;
  stroke-width: 2px;
  filter: drop-shadow(0 1px 2px #181a10);
}
.atlas-road-closed { stroke: #d9c28a; stroke-width: 1.15px; stroke-dasharray: 3 5; opacity: .66; }

.atlas-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  transform: translate(-50%,-50%);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #eee3c3;
  cursor: pointer;
}
.atlas-pin:hover, .atlas-pin.is-selected, .atlas-pin.is-here { z-index: 2; }
.atlas-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid #e3d0a288;
  background: #232d23;
  box-shadow: 0 1px 3px #050d0a, 0 0 0 3px #1e2a1f7a;
  transition: box-shadow .16s ease, background-color .16s ease;
}
.atlas-fort-dot { border-radius: 2px; transform: rotate(45deg); }
.atlas-danger-dot { border-radius: 3px; border-color: #d78c6e; }
.atlas-pin.is-open .atlas-dot { background: #e8bf78; border-color: #f2d9a5; }
.atlas-pin.is-selected .atlas-dot, .atlas-pin:hover .atlas-dot {
  box-shadow: 0 1px 3px #050d0a, 0 0 0 4px #e5c78267;
}
.atlas-pin.is-here .atlas-dot {
  width: 14px;
  height: 14px;
  border: 3px solid #f1deb0;
  background: #758c67;
  box-shadow: 0 0 0 4px #1c3e32b0, 0 0 0 5px #c2d2a9ae;
}
.atlas-pin-label {
  position: absolute;
  top: calc(50% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 94px;
  border: 1px solid #ba9e6452;
  border-radius: 4px;
  background: #18211bea;
  color: #eddfbd;
  padding: 2px 5px 3px;
  white-space: normal;
  text-align: center;
  font: 700 clamp(9px, 2.45vw, 11.5px)/1.04 Interface, system-ui, sans-serif;
}
.atlas-pin.is-closed .atlas-pin-label { background: #172118dc; color: #e5d9b9; }
.atlas-pin.is-here .atlas-pin-label { color: #f1e7ce; background: #294637; border-color: #b9ca9d; }
.atlas-pin.is-selected .atlas-pin-label { border-color: #efc883; }

.atlas-overview-btn {
  position: absolute;
  z-index: 5;
  top: 13px;
  left: 13px;
  min-height: 33px;
  background: #14241ded;
}
.atlas-compass {
  position: absolute;
  z-index: 4;
  right: 16px;
  bottom: 15px;
  display: grid;
  place-items: center;
  gap: 3px;
  width: 35px;
  color: #f1dca3;
  text-shadow: 0 1px 3px #0d1b15;
  font: 400 13px/1 Display, Georgia, serif;
  pointer-events: none;
}
.atlas-compass i {
  position: relative;
  width: 28px;
  height: 28px;
  border: 1px solid #ddcca18c;
  border-radius: 50%;
  background: #1c2a2188;
}
.atlas-compass i::before, .atlas-compass i::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 3px;
  width: 10px;
  height: 20px;
  clip-path: polygon(50% 0, 100% 56%, 50% 49%, 0 56%);
  background: #f8d48a;
}
.atlas-compass i::after { transform: rotate(180deg); background: #9bb5a0; }
.atlas-district .atlas-compass { display: none; }
.atlas-map-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 17px;
  padding: 8px 0 3px;
  color: var(--atlas-subtle);
  font: 400 10px/1.3 Interface, system-ui, sans-serif;
}
.atlas-map-key span { display: inline-flex; gap: 6px; align-items: center; }
.atlas-map-key i { width: 8px; height: 8px; border: 1px solid #bbaa82; border-radius: 50%; }
.key-here { background: #8caa80; }
.key-open { background: #eac37e; }
.key-closed { background: #232b23; }

.atlas-side { display: grid; gap: 8px; align-content: start; min-width: 0; }
.atlas-selection {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 69px;
  padding: 8px 9px;
  border: 1px solid #75644892;
  border-radius: 8px;
  background: linear-gradient(120deg,#202a21,#111a15 75%);
}
.atlas-selection img {
  flex-shrink: 0;
  width: 63px;
  height: 49px;
  object-fit: cover;
  border: 1px solid #a18d64;
  border-radius: 5px;
}
.atlas-place { flex: 1; min-width: 0; }
.atlas-place-state {
  color: var(--atlas-gold);
  font: 700 9px/1.1 Interface, system-ui, sans-serif;
  letter-spacing: .105em;
  text-transform: uppercase;
}
.atlas-place h2 {
  margin: 2px 0 0;
  color: #f1e6cc;
  font: 400 21px/1.03 Display, Georgia, serif;
  overflow-wrap: anywhere;
}
.atlas-place p {
  margin: 4px 0 0;
  color: var(--atlas-subtle);
  font: 400 11px/1.23 Interface, system-ui, sans-serif;
}
.atlas-enter, .atlas-play {
  min-height: 39px;
  padding: 7px 12px;
  border: 1px solid #a78d59;
  border-radius: 7px;
  background: linear-gradient(135deg,#e8c587,#b89457);
  color: #211d13;
  box-shadow: inset 0 1px #f7deb8a1;
  font: 700 12px/1.2 Interface, system-ui, sans-serif;
  cursor: pointer;
}
.atlas-enter:hover, .atlas-play:hover { background: #ebce94; }
.atlas-footer { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 8px; }
.atlas-actions { position: relative; z-index: 6; }
.atlas-actions summary { gap: 6px; list-style: none; min-height: 40px; }
.atlas-actions summary::-webkit-details-marker { display: none; }
.atlas-action-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 5px;
  width: min(280px, 80vw);
  padding: 7px;
  border: 1px solid var(--atlas-rule);
  border-radius: 8px;
  background: #172019;
  box-shadow: 0 9px 30px #031009ac;
}
.atlas-action-menu button { justify-content: flex-start; min-height: 34px; }
.atlas-play {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 40px;
}
.atlas-play-icon { font-size: 10px; }
#playLevelLabelMap {
  inset: auto;
  position: static;
  padding-left: 9px;
  border-left: 1px solid #62503062;
  color: #4c3a22;
  font: 700 10px/1 Interface, system-ui, sans-serif;
}
.atlas-screen button:focus-visible, .atlas-screen summary:focus-visible {
  outline: 2px solid #f8d998;
  outline-offset: 3px;
}

@media (min-width: 720px) {
  .atlas-header { margin-bottom: 14px; padding: 4px 0 12px; }
  .atlas-layout { grid-template-columns: minmax(0,1.62fr) minmax(245px,1fr); gap: 16px; align-items: center; }
  .atlas-main {
    padding: 8px 0 4px;
    border-radius: 10px;
    background: radial-gradient(ellipse at center, #5b533c48, transparent 75%);
  }
  .atlas-frame { width: min(100%, calc(75dvh - 139px)); height: auto; min-height: 0; aspect-ratio: 3 / 4; }
  .atlas-side { align-self: start; gap: 14px; margin-top: 34px; }
  .atlas-selection { display: grid; grid-template-columns: minmax(0,1fr); gap: 11px; padding: 12px; }
  .atlas-selection img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .atlas-place { padding: 2px 3px 5px; }
  .atlas-place h2 { margin-top: 4px; font-size: 30px; }
  .atlas-place p { margin-top: 7px; font-size: 12px; }
  .atlas-enter { width: 100%; }
  .atlas-action-menu { bottom: auto; top: calc(100% + 7px); }
}
@media (max-width: 350px) {
  .atlas-header { gap: 7px; }
  .atlas-control, .atlas-enter { padding-inline: 9px; }
  .atlas-dot { width: 10px; height: 10px; }
  .atlas-pin-label { max-width: 70px; padding-inline: 4px; }
  .atlas-selection img { width: 53px; height: 46px; }
  .atlas-map-key { gap: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-dot { transition: none; }
}
