.atlas-hero {
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 78% 28%, rgba(229, 182, 90, .18), transparent 26%),
    radial-gradient(circle at 12% 8%, rgba(69, 196, 154, .13), transparent 30%),
    linear-gradient(180deg, #102f38, var(--ink));
}

.atlas-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  background-image:
    repeating-linear-gradient(115deg, transparent 0 28px, rgba(255,255,255,.055) 29px 30px),
    radial-gradient(circle at center, transparent 40%, #000 110%);
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

.atlas-hero > * { position: relative; z-index: 1; }
.atlas-hero h1 { max-width: 980px; }

.atlas-section {
  width: min(1740px, calc(100% - 1.5rem));
  margin: -3.2rem auto 5rem;
  position: relative;
  z-index: 5;
}

.atlas-commandbar,
.atlas-sidebar,
.atlas-inspector,
.atlas-stage {
  border: 1px solid rgba(197, 222, 211, .16);
  background: #0a2028;
  box-shadow: 0 22px 65px rgba(0, 0, 0, .32);
}

.atlas-commandbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr);
  align-items: center;
  gap: 1rem;
  padding: .75rem 1rem;
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent),
    #0a2028;
}

.atlas-title-lockup {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}

.atlas-crest {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(229,182,90,.52);
  border-radius: 50% 50% 44% 44%;
  color: var(--gold);
  background: radial-gradient(circle at 35% 30%, rgba(229,182,90,.22), transparent 50%);
  font: 700 1.2rem var(--serif);
  box-shadow: inset 0 0 0 3px #0a2028, 0 0 0 1px rgba(229,182,90,.15);
}

.atlas-title-lockup > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.atlas-title-lockup small { color: #80afa9; text-transform: uppercase; letter-spacing: .13em; font-size: .58rem; }
.atlas-title-lockup b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 700 .98rem var(--serif); }
.atlas-title-lockup i { font-style: normal; color: #76cbb2; font-size: .66rem; margin-left: .4rem; white-space: nowrap; }

.atlas-toolset,
.atlas-view-tools,
.atlas-data-buttons {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.atlas-tool,
.atlas-view-tools button,
.atlas-data-buttons button,
.atlas-data-buttons label {
  appearance: none;
  border: 1px solid rgba(197,222,211,.15);
  background: rgba(255,255,255,.035);
  color: #c9d8d7;
  border-radius: 9px;
  min-height: 38px;
  padding: .45rem .7rem;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}

.atlas-tool {
  min-width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .74rem;
}

.atlas-tool span { color: var(--gold); font-size: 1rem; }
.atlas-tool:hover,
.atlas-view-tools button:hover,
.atlas-data-buttons button:hover,
.atlas-data-buttons label:hover { border-color: rgba(229,182,90,.5); color: #fff; transform: translateY(-1px); }
.atlas-tool.active { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.atlas-tool.active span { color: var(--ink); }
.atlas-tool:disabled { opacity: .36; cursor: not-allowed; transform: none; }
.atlas-tool.finish-route { background: rgba(69,196,154,.16); border-color: rgba(69,196,154,.5); }
.atlas-tool[hidden] { display: none !important; }

.atlas-view-tools { justify-content: flex-end; }
.atlas-view-tools button { min-width: 38px; padding-inline: .62rem; }
.atlas-view-tools output { width: 48px; text-align: center; color: #85a7a5; font-size: .68rem; }
.atlas-view-tools .atlas-home-view { min-width: 72px; }
.atlas-view-tools .atlas-edit-toggle { margin-left: .45rem; min-width: 100px; border-color: rgba(229,182,90,.38); color: #f0d38e; }
.atlas-view-tools .atlas-edit-toggle[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 800; box-shadow: 0 0 22px rgba(229,182,90,.15); }

.atlas-workspace {
  display: grid;
  grid-template-columns: 250px minmax(420px, 1fr) 330px;
  min-height: 680px;
}

.atlas-sidebar,
.atlas-inspector {
  box-shadow: none;
  border-top: 0;
}

.atlas-sidebar {
  padding: 1rem;
  border-radius: 0 0 0 18px;
  overflow: auto;
  max-height: min(78vh, 880px);
  scrollbar-width: thin;
  scrollbar-color: rgba(229,182,90,.35) transparent;
}

.atlas-search { display: flex; flex-direction: column; gap: .3rem; color: #7ea5a3; font-size: .67rem; text-transform: uppercase; letter-spacing: .1em; }
.atlas-search input,
.atlas-editor-form input,
.atlas-editor-form select,
.atlas-editor-form textarea {
  width: 100%;
  border: 1px solid rgba(197,222,211,.16);
  border-radius: 9px;
  background: #06171d;
  color: #f8f2e4;
  padding: .68rem .72rem;
  outline: none;
}
.atlas-search input:focus,
.atlas-editor-form input:focus,
.atlas-editor-form select:focus,
.atlas-editor-form textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(229,182,90,.08); }

.atlas-search-results {
  margin-top: .55rem;
  padding: .3rem;
  border: 1px solid rgba(197,222,211,.12);
  border-radius: 10px;
  background: #06171d;
}

.atlas-search-results button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  border: 0;
  border-bottom: 1px solid rgba(197,222,211,.08);
  padding: .55rem;
  background: transparent;
  color: #d7e4df;
  text-align: left;
  cursor: pointer;
}
.atlas-search-results button:last-child { border-bottom: 0; }
.atlas-search-results button:hover { color: var(--gold); }
.atlas-search-results small { color: #6f9996; }

.atlas-panel-block { padding: 1.1rem 0; border-bottom: 1px solid rgba(197,222,211,.1); }
.atlas-panel-heading { display: flex; align-items: center; gap: .55rem; margin-bottom: .75rem; }
.atlas-panel-heading small { color: var(--gold); font-size: .6rem; letter-spacing: .12em; }
.atlas-panel-heading h2 { margin: 0; font: 700 1.03rem var(--serif); }

.atlas-layer-list { display: grid; gap: .2rem; }
.atlas-layer-list label {
  display: grid;
  grid-template-columns: 18px 9px 1fr;
  align-items: center;
  gap: .55rem;
  padding: .43rem .35rem;
  border-radius: 8px;
  cursor: pointer;
}
.atlas-layer-list label:hover { background: rgba(255,255,255,.035); }
.atlas-layer-list input { accent-color: var(--gold); }
.atlas-layer-list span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.atlas-layer-list b { color: #dce7e2; font-size: .78rem; }
.atlas-layer-list small { color: #658a89; font-size: .62rem; }
.layer-swatch { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.layer-swatch.wards { color: #63c5a2; background: currentColor; }
.layer-swatch.roads { color: #e5b65a; background: currentColor; }
.layer-swatch.landmarks { color: #f1e9d7; background: currentColor; }
.layer-swatch.campaign { color: #f08b59; background: currentColor; }
.layer-swatch.atmosphere { color: #769ad0; background: currentColor; }

.atlas-ward-list { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.atlas-ward-list button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .5rem .55rem;
  background: rgba(255,255,255,.03);
  color: #b9cdca;
  text-align: left;
  font-size: .69rem;
  cursor: pointer;
}
.atlas-ward-list button:hover,
.atlas-ward-list button.active { border-color: var(--ward-color, var(--gold)); color: #fff; background: rgba(255,255,255,.065); }
.atlas-ward-list i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: .4rem; background: var(--ward-color, var(--gold)); }

.atlas-data-tools p { margin: 0 0 .75rem; color: #728f8e; font-size: .68rem; line-height: 1.45; }
.atlas-data-buttons { flex-wrap: wrap; }
.atlas-data-buttons button,
.atlas-data-buttons label { min-height: 32px; padding: .35rem .5rem; font-size: .65rem; }
.atlas-data-buttons label { position: relative; overflow: hidden; }
.atlas-data-buttons input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.atlas-data-buttons .danger { color: #e99993; }
.atlas-source-note { color: #5f8381; font-size: .62rem; line-height: 1.5; margin: 1rem 0 0; }
.atlas-source-note a { color: #83cdb5; }

.atlas-stage {
  min-width: 0;
  position: relative;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  overflow: hidden;
  background: #071a22;
}

.atlas-map-frame {
  width: 100%;
  height: min(78vh, 880px);
  min-height: 680px;
  border: 0;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  background: #06171d;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.atlas-map-frame:active { cursor: grabbing; }
.atlas-map-frame[data-tool="marker"],
.atlas-map-frame[data-tool="route"] { cursor: crosshair; }
.atlas-map-frame:focus-visible { outline: 3px solid var(--gold); outline-offset: -4px; }

.atlas-map-svg { display: block; width: 100%; height: 100%; }
.atlas-base { filter: saturate(.84) contrast(1.04) brightness(.8); }
.atlas-map-wash { fill: rgba(4,17,22,.08); }
.atlas-map-grain { opacity: .28; mix-blend-mode: soft-light; pointer-events: none; }
.atlas-vignette { pointer-events: none; }

.atlas-ward {
  fill: var(--ward-color);
  fill-opacity: .08;
  stroke: var(--ward-color);
  stroke-opacity: .54;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity .18s, stroke-opacity .18s;
  cursor: pointer;
}
.atlas-ward:hover,
.atlas-ward.selected { fill-opacity: .19; stroke-opacity: 1; }
.atlas-ward-label {
  fill: #f8f0db;
  font: 800 21px var(--serif);
  letter-spacing: .12em;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5,19,25,.92);
  stroke-width: 6;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: .86;
}
.atlas-ward-label-sub { fill: #b9cbc5; font: 700 9px var(--sans); letter-spacing: .22em; text-anchor: middle; paint-order: stroke; stroke: rgba(5,19,25,.95); stroke-width: 4; pointer-events: none; }

.atlas-road {
  fill: none;
  stroke: #f1d493;
  stroke-width: 4;
  stroke-opacity: .68;
  stroke-linecap: round;
  stroke-dasharray: 1 10;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 2px #000);
  pointer-events: none;
}
.atlas-road-label { fill: #f1d493; font: 700 9px var(--sans); letter-spacing: .14em; paint-order: stroke; stroke: #071a22; stroke-width: 4; pointer-events: none; }

.atlas-route-path {
  fill: none;
  stroke: var(--route-color, #ef8757);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 11 9;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(239,135,87,.55));
  cursor: pointer;
}
.atlas-route-hit { fill: none; stroke: transparent; stroke-width: 20; vector-effect: non-scaling-stroke; cursor: pointer; }
.atlas-route.selected .atlas-route-path { stroke: #fff0b6; stroke-width: 6; }
.atlas-route-node { fill: #071a22; stroke: var(--route-color, #ef8757); stroke-width: 3; vector-effect: non-scaling-stroke; }
.atlas-route-draft { fill: none; stroke: #69d5b0; stroke-width: 4; stroke-dasharray: 6 7; vector-effect: non-scaling-stroke; }
.atlas-route-draft-node { fill: #69d5b0; stroke: #071a22; stroke-width: 3; vector-effect: non-scaling-stroke; }

.atlas-marker { cursor: pointer; outline: none; }
.atlas-marker .marker-halo { fill: var(--marker-color); opacity: .13; transition: opacity .18s, r .18s; }
.atlas-marker .marker-pin { fill: #0b222a; stroke: var(--marker-color); stroke-width: 3; vector-effect: non-scaling-stroke; filter: drop-shadow(0 4px 5px rgba(0,0,0,.65)); }
.atlas-marker .marker-core { fill: var(--marker-color); }
.atlas-marker .marker-glyph { fill: #071a22; font: 900 11px var(--sans); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.atlas-marker .marker-label-bg { fill: rgba(5,18,23,.9); stroke: rgba(255,255,255,.14); stroke-width: 1; vector-effect: non-scaling-stroke; }
.atlas-marker .marker-label { fill: #f8f2e3; font: 700 12px var(--sans); dominant-baseline: middle; pointer-events: none; }
.atlas-marker .marker-kind { fill: #85aaa6; font: 700 7px var(--sans); letter-spacing: .14em; dominant-baseline: middle; pointer-events: none; }
.atlas-marker:hover .marker-halo,
.atlas-marker:focus .marker-halo,
.atlas-marker.selected .marker-halo { opacity: .42; r: 25px; }
.atlas-marker.selected .marker-pin { stroke: #fff3c4; stroke-width: 4; }
.atlas-marker[data-category="campaign"] .marker-pin { fill: #321d18; }
.atlas-marker[data-category="campaign"] .marker-label-bg { stroke: rgba(239,135,87,.45); }
.atlas-marker[data-category="custom"] .marker-pin { fill: #1b1730; }

.atlas-water-lines { fill: none; stroke: rgba(134,210,208,.18); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.atlas-fog-bank { fill: url(#atlasFog); opacity: .2; pointer-events: none; }

.atlas-hud {
  position: absolute;
  left: .85rem;
  right: .85rem;
  bottom: .7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .47rem .65rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  background: rgba(4,17,22,.78);
  backdrop-filter: blur(10px);
  color: #9ab6b2;
  font-size: .61rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  pointer-events: none;
}
.atlas-hud i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: .4rem; background: #69d5b0; box-shadow: 0 0 9px #69d5b0; }
.atlas-scale { display: flex; align-items: center; gap: .45rem; }
.atlas-scale b { display: inline-block; width: 52px; height: 5px; border: solid #e8d08f; border-width: 0 1px 1px; }

.atlas-map-help {
  position: absolute;
  top: .75rem;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: .4rem .7rem;
  background: rgba(4,17,22,.72);
  color: #b8ccc8;
  backdrop-filter: blur(10px);
  font-size: .64rem;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .3s;
}
.atlas-map-help.quiet { opacity: 0; }

.atlas-inspector {
  border-radius: 0 0 18px 0;
  padding: 1.35rem;
  overflow: auto;
  max-height: min(78vh, 880px);
  background:
    radial-gradient(circle at 100% 0, rgba(229,182,90,.08), transparent 28%),
    #0a2028;
  scrollbar-width: thin;
  scrollbar-color: rgba(229,182,90,.35) transparent;
}
.atlas-inspector .eyebrow { margin-bottom: .5rem; }
.atlas-inspector h2 { font-size: clamp(1.7rem, 2.2vw, 2.8rem); line-height: 1.02; margin: 0 0 .8rem; }
.atlas-inspector > p:not(.eyebrow) { color: #9ab3b0; }
.atlas-inspector-art {
  height: 145px;
  margin: -1.35rem -1.35rem 1.15rem;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: #06171d;
}
.atlas-inspector-art img { width: 100%; height: 100%; object-fit: cover; }
.atlas-inspector-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, #0a2028, transparent 70%); }
.atlas-inspector-badge { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .65rem; color: var(--gold); font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; }
.atlas-inspector-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 9px currentColor; }
.atlas-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 1rem 0; }
.atlas-stat-grid div { padding: .65rem; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; background: rgba(255,255,255,.025); }
.atlas-stat-grid small { display: block; color: #6e9693; font-size: .57rem; letter-spacing: .1em; text-transform: uppercase; }
.atlas-stat-grid b { font: 700 .92rem var(--serif); }
.atlas-inspector-copy { color: #9ab3b0; font-size: .87rem; }
.atlas-inspector-copy strong { color: #e7d39b; }
.atlas-inspector .button { margin-top: .7rem; }
.atlas-editor-hint { margin: 1rem 0; padding: .7rem; border: 1px dashed rgba(229,182,90,.32); border-radius: 9px; color: #cbb987; font-size: .72rem; }

.atlas-editor-form { display: grid; gap: .7rem; margin-top: 1rem; }
.atlas-editor-form label { display: flex; flex-direction: column; gap: .25rem; color: #729795; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.atlas-editor-form textarea { min-height: 92px; resize: vertical; }
.atlas-editor-row { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.atlas-editor-actions { display: flex; gap: .5rem; margin-top: .3rem; }
.atlas-editor-actions button {
  flex: 1;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  padding: .58rem;
  background: rgba(255,255,255,.04);
  color: #d6e2de;
  cursor: pointer;
}
.atlas-editor-actions button:hover { border-color: var(--gold); }
.atlas-editor-actions .delete { color: #ef9b94; }

.atlas-route-steps { list-style: none; padding: 0; margin: .8rem 0; }
.atlas-route-steps li { display: flex; gap: .55rem; align-items: center; padding: .42rem 0; color: #9fb5b1; font-size: .75rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.atlas-route-steps b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(239,135,87,.14); color: #ef8757; font-size: .58rem; }

.atlas-threads { margin-top: 0; }

@media (max-width: 1360px) {
  .atlas-commandbar { grid-template-columns: 1fr auto; }
  .atlas-title-lockup { grid-column: 1; }
  .atlas-toolset { grid-column: 2; grid-row: 1; }
  .atlas-view-tools { grid-column: 1 / -1; justify-content: center; border-top: 1px solid rgba(255,255,255,.08); padding-top: .55rem; }
  .atlas-workspace { grid-template-columns: 220px minmax(380px, 1fr) 285px; }
}

@media (max-width: 1060px) {
  .atlas-workspace { grid-template-columns: 210px minmax(0, 1fr); }
  .atlas-inspector { grid-column: 1 / -1; border-radius: 0 0 18px 18px; max-height: none; border-left: 1px solid rgba(197,222,211,.16); display: grid; grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); gap: 1rem; }
  .atlas-inspector-art { display: none; }
  .atlas-map-frame { height: 70vh; min-height: 600px; }
  .atlas-sidebar { max-height: 70vh; }
}

@media (max-width: 760px) {
  .atlas-section { width: 100%; margin-top: -1.5rem; }
  .atlas-commandbar { border-radius: 0; padding: .7rem; display: flex; flex-wrap: wrap; }
  .atlas-title-lockup { width: 100%; }
  .atlas-title-lockup i { margin-left: auto; }
  .atlas-toolset { order: 3; width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
  .atlas-tool { min-width: 0; }
  .atlas-view-tools { order: 2; flex: 1; justify-content: flex-end; border: 0; padding: 0; }
  .atlas-view-tools output,
  .atlas-home-view { display: none; }
  .atlas-view-tools .atlas-edit-toggle { min-width: 90px; }
  .atlas-workspace { display: flex; flex-direction: column; }
  .atlas-stage { order: 1; }
  .atlas-sidebar { order: 2; max-height: none; border-radius: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
  .atlas-search,
  .atlas-search-results,
  .atlas-source-note { grid-column: 1 / -1; }
  .atlas-inspector { order: 3; display: block; border-radius: 0; }
  .atlas-map-frame { min-height: 520px; height: 68vh; }
  .atlas-ward-label { font-size: 16px; }
  .atlas-hud { font-size: .53rem; }
  #atlasCoordinates { display: none; }
}

@media (max-width: 520px) {
  .atlas-title-lockup i { display: none; }
  .atlas-sidebar { display: block; }
  .atlas-ward-list { grid-template-columns: repeat(3, 1fr); }
  .atlas-map-frame { height: 72vw; min-height: 275px; max-height: 340px; }
  .atlas-marker .marker-label-bg,
  .atlas-marker .marker-label,
  .atlas-marker .marker-kind { display: none; }
  .atlas-map-help { max-width: calc(100% - 1rem); overflow: hidden; text-overflow: ellipsis; }
  .atlas-hud { left: .4rem; right: .4rem; }
  .atlas-hud > span:first-child { display: none; }
  .atlas-hud { justify-content: flex-end; }
  .atlas-editor-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-tool,
  .atlas-view-tools button,
  .atlas-marker .marker-halo,
  .atlas-ward { transition: none; }
}
