/* ANGEL NAVI's existing palette and type remain the source of this panel. */
#atlas-page-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#atlas-page-nav #atlas-page-guide { color: var(--atlas-shell-accent); background: var(--atlas-accent-soft); font-weight: 700; }
#atlas-page-nav .atlas-story-nav-short{display:none}
@media(max-width:480px){
  #atlas-page-nav #atlas-page-guide{white-space:nowrap}
  #atlas-page-nav .atlas-story-nav-full{display:none}
  #atlas-page-nav .atlas-story-nav-short{display:inline}
}
html[data-atlas-story-open] #building-detail,
html[data-atlas-story-open] .region-overview-info { visibility: hidden; pointer-events: none; }
#detail-story-jump { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; margin: 0 0 14px; padding: 9px 15px; border: 1px solid var(--atlas-gold, #bba2ff); border-radius: 12px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); font: 750 13px/1.3 system-ui, sans-serif; cursor: pointer; }
#detail-story-jump[hidden] { display: none; }
#detail-story-jump:hover { background: var(--atlas-gold, #bba2ff); color: #231b39; }

#atlas-story-panel {
  position: fixed;
  z-index: 1800;
  top: 100px;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(70px + env(safe-area-inset-bottom));
  width: min(390px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--atlas-fg, #f4efff);
  background: var(--atlas-panel, #242033);
  border: 1px solid var(--atlas-line, #49405e);
  border-radius: 21px;
  box-shadow: 0 22px 55px rgb(9 5 22 / 34%);
  font: 400 14px/1.5 system-ui, sans-serif;
  isolation: isolate;
}
#atlas-story-panel[hidden] { display: none; }
#atlas-story-panel * { box-sizing: border-box; }
#atlas-story-panel button,
#atlas-story-panel input,
#atlas-story-panel select,
#atlas-story-panel textarea { font: inherit; }
#atlas-story-panel button { cursor: pointer; }
#atlas-story-panel :is(button,a,input,select,textarea):focus-visible { outline: 3px solid var(--atlas-gold, #bba2ff); outline-offset: 2px; }
#atlas-story-panel .atlas-story-top {
  flex: none;
  padding: 22px 21px 17px;
  border-bottom: 1px solid var(--atlas-line, #49405e);
  background: radial-gradient(circle at 98% 0%, rgb(166 126 255 / 17%), transparent 43%), linear-gradient(135deg, var(--atlas-panel, #242033), var(--atlas-raised, #30283f));
}
#atlas-story-panel .atlas-story-eyebrow { display: block; color: var(--atlas-gold, #bba2ff); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
#atlas-story-panel .atlas-story-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
#atlas-story-panel .atlas-story-top-actions { display: flex; align-items: center; gap: 7px; }
#atlas-story-panel .atlas-story-title { margin: 0; font-size: 24px; font-weight: 780; letter-spacing: -.055em; line-height: 1.25; }
#atlas-story-panel .atlas-story-subtitle { min-height: 18px; margin: 7px 0 0; color: var(--atlas-muted, #bbb1d1); font-size: 12px; }
#atlas-story-panel .atlas-story-close {
  flex: none; min-width: 54px; min-height: 44px; padding: 7px 10px;
  border: 1px solid var(--atlas-line, #49405e); border-radius: 13px;
  color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f);
  font-size: 12px; font-weight: 740; line-height: 1.25;
}
#atlas-story-panel .atlas-story-filter-toggle {
  flex: none; min-width: 54px; min-height: 44px; padding: 7px 10px;
  border: 1px solid var(--atlas-line, #49405e); border-radius: 13px;
  color: var(--atlas-fg, #f4efff); background: transparent;
  font-size: 12px; font-weight: 740; line-height: 1.25;
}
#atlas-story-panel .atlas-story-filter-toggle[aria-expanded=true],
#atlas-story-panel .atlas-story-filter-toggle[data-active=true] {
  color: var(--atlas-gold, #bba2ff); border-color: var(--atlas-gold, #bba2ff);
  background: color-mix(in srgb, var(--atlas-gold, #bba2ff) 12%, transparent);
}
#atlas-story-panel .atlas-story-filter-toggle[hidden] { display: none; }
#atlas-story-panel .atlas-story-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 21px 18px; scrollbar-width: thin; }
#atlas-story-panel .atlas-story-bottom { flex: none; padding: 11px 20px 15px; border-top: 1px solid var(--atlas-line, #49405e); background: var(--atlas-panel, #242033); }
#atlas-story-panel .atlas-story-bottom[hidden] { display: none; }
#atlas-story-panel .atlas-story-bottom button { width: 100%; }
#atlas-story-panel .atlas-story-controls { padding-top: 16px; }
#atlas-story-panel .atlas-story-extra-filters { display: grid; gap: 9px; margin-top: 10px; }
#atlas-story-panel .atlas-story-extra-filters[hidden] { display: none; }
#atlas-story-panel .atlas-story-clear-place { min-height: 36px; margin-bottom: 10px; padding: 5px 0; border: 0; color: var(--atlas-gold, #bba2ff); background: transparent; font-size: 12px; font-weight: 800; }
#atlas-story-panel .atlas-story-cities { display: flex; gap: 7px; }
#atlas-story-panel .atlas-story-city {
  min-height: 37px; padding: 7px 12px; border: 1px solid var(--atlas-line, #49405e); border-radius: 999px;
  color: var(--atlas-muted, #bbb1d1); background: var(--atlas-raised, #30283f); font-size: 12px; font-weight: 700;
}
#atlas-story-panel .atlas-story-city[aria-pressed=true] { color: #231b39; background: var(--atlas-gold, #bba2ff); border-color: var(--atlas-gold, #bba2ff); }
#atlas-story-panel .atlas-story-topic { width: 100%; min-height: 39px; margin: 0; padding: 6px 12px; border: 1px solid var(--atlas-line, #49405e); border-radius: 10px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); font-size: 12px; font-weight: 700; }
#atlas-story-panel .atlas-story-search { display: flex; gap: 7px; margin: 0; }
#atlas-story-panel .atlas-story-search-field { min-width: 0; min-height: 44px; flex: 1; padding: 8px 12px; border: 1px solid var(--atlas-line, #49405e); border-radius: 12px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); font-size: 14px; }
#atlas-story-panel .atlas-story-search-field::placeholder { color: var(--atlas-muted, #bbb1d1); }
#atlas-story-panel .atlas-story-find { min-width: 58px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--atlas-line, #49405e); border-radius: 12px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); font-weight: 750; }
#atlas-story-panel .atlas-story-status { margin: 16px 0 0; color: var(--atlas-muted, #bbb1d1); font-size: 12px; }
#atlas-story-panel .atlas-story-status:empty { display: none; }
#atlas-story-panel .atlas-story-success { margin: 14px 0 0; padding: 11px 13px; border: 1px solid var(--atlas-gold, #bba2ff); border-radius: 11px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); font-size: 12px; font-weight: 700; }
#atlas-story-panel .atlas-story-empty,
#atlas-story-panel .atlas-story-unavailable { margin: 22px 0; padding: 16px; border: 1px solid var(--atlas-line, #49405e); border-radius: 13px; background: var(--atlas-raised, #30283f); color: var(--atlas-muted, #bbb1d1); line-height: 1.6; }
#atlas-story-panel .atlas-story-empty { display: grid; gap: 8px; margin: 13px 0; padding: 12px 14px; }
#atlas-story-panel .atlas-story-empty-message { margin: 0; }
#atlas-story-panel .atlas-story-empty .atlas-story-secondary { justify-self: start; min-height: 36px; padding: 6px 11px; }
#atlas-story-panel .atlas-story-list { display: block; list-style: none; margin: 10px 0 0; padding: 0; }
#atlas-story-panel .atlas-story-item { padding: 14px 0; border: 0; border-bottom: 1px solid var(--atlas-line, #49405e); border-radius: 0; background: transparent; transition: border-color .15s ease; }
#atlas-story-panel .atlas-story-item:focus-within,
#atlas-story-panel .atlas-story-item:hover { border-color: var(--atlas-gold, #bba2ff); }
#atlas-story-panel .atlas-story-item-kicker { display: flex; align-items: center; gap: 9px; color: var(--atlas-muted, #bbb1d1); font-size: 11px; }
#atlas-story-panel .atlas-story-region { padding: 3px 7px; border-radius: 6px; color: var(--atlas-gold, #bba2ff); background: var(--atlas-raised, #30283f); font-weight: 800; }
#atlas-story-panel .atlas-story-origin { margin-left: auto; white-space: nowrap; color: var(--atlas-muted, #bbb1d1); font-size: 10px; }
#atlas-story-panel .atlas-story-item-title { display: block; width: 100%; margin: 10px 0 0; padding: 0; border: 0; background: none; color: var(--atlas-fg, #f4efff); text-align: left; font-size: 16px; font-weight: 760; line-height: 1.43; letter-spacing: -.035em; }
#atlas-story-panel .atlas-story-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 6px 0 10px; color: var(--atlas-muted, #bbb1d1); font-size: 12px; line-height: 1.6; }
#atlas-story-panel .atlas-story-item-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; margin-top: 10px; color: var(--atlas-muted, #bbb1d1); font-size: 11px; }
#atlas-story-panel .atlas-story-languages { color: var(--atlas-gold, #bba2ff); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
#atlas-story-panel .atlas-story-map-link { min-height: 30px; padding: 4px 0; border: 0; background: none; color: var(--atlas-gold, #bba2ff); font-size: 11px; font-weight: 750; text-align: left; }
#atlas-story-panel .atlas-story-primary,
#atlas-story-panel .atlas-story-secondary,
#atlas-story-panel .atlas-story-more { min-height: 44px; padding: 10px 15px; border-radius: 12px; font-weight: 800; }
#atlas-story-panel .atlas-story-primary { border: 1px solid var(--atlas-gold, #bba2ff); color: #231b39; background: var(--atlas-gold, #bba2ff); }
#atlas-story-panel .atlas-story-signin { width: 100%; }
#atlas-story-panel .atlas-story-secondary,
#atlas-story-panel .atlas-story-more { border: 1px solid var(--atlas-line, #49405e); color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); }
#atlas-story-panel .atlas-story-more { display: block; width: 100%; margin-top: 16px; }
#atlas-story-panel .atlas-story-back { min-height: 43px; margin: 10px 0 2px; padding: 7px 0; border: 0; color: var(--atlas-gold, #bba2ff); background: none; font-size: 12px; font-weight: 760; }
#atlas-story-panel .atlas-story-article h3 { margin: 12px 0; font-size: 21px; line-height: 1.4; letter-spacing: -.045em; }
#atlas-story-panel .atlas-story-article-meta { color: var(--atlas-muted, #bbb1d1); font-size: 11px; }
#atlas-story-panel .atlas-story-article-language { display: inline-flex; margin: 8px 0 0; padding: 5px 9px; border-radius: 7px; color: var(--atlas-gold, #bba2ff); background: var(--atlas-raised, #30283f); font-size: 11px; font-weight: 800; }
#atlas-story-panel .atlas-story-manage-button { display: inline-flex; align-items: center; min-height: 44px; margin: 4px 0 4px 8px; padding: 9px 12px; border: 1px solid var(--atlas-line, #49405e); border-radius: 10px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); font: 750 12px/1.4 system-ui, sans-serif; cursor: pointer; }
#atlas-story-panel .atlas-story-manage-button:focus-visible { outline: 3px solid var(--atlas-gold, #bba2ff); outline-offset: 2px; }
#atlas-story-panel .atlas-story-article-body { margin: 20px 0; color: var(--atlas-fg, #f4efff); line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
#atlas-story-panel .atlas-story-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 14px 0 20px; }
#atlas-story-panel .atlas-story-photo-thumb { display: block; width: 100%; padding: 0; border: 1px solid var(--atlas-line, #49405e); border-radius: 11px; background: var(--atlas-raised, #30283f); overflow: hidden; cursor: zoom-in; }
#atlas-story-panel .atlas-story-photo-thumb:focus-visible { outline: 3px solid var(--atlas-gold, #bba2ff); outline-offset: 2px; }
#atlas-story-panel .atlas-story-photos img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.atlas-story-photo-dialog { box-sizing: border-box; width: min(96vw, 1200px); max-width: 96vw; max-height: 94vh; margin: auto; padding: 12px; border: 1px solid #73668e; border-radius: 18px; color: #f4efff; background: #171529; box-shadow: 0 24px 80px #000a; }
.atlas-story-photo-dialog::backdrop { background: #090714e0; }
.atlas-story-photo-close { display: block; min-width: 44px; min-height: 44px; margin: 0 0 8px auto; border: 1px solid #73668e; border-radius: 10px; color: #fff; background: #30283f; font-size: 25px; cursor: pointer; }
.atlas-story-photo-large { display: block; max-width: 100%; max-height: calc(94vh - 112px); margin: auto; object-fit: contain; }
.atlas-story-photo-footer { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 48px; }
.atlas-story-photo-prev, .atlas-story-photo-next { min-width: 44px; min-height: 44px; border: 1px solid #73668e; border-radius: 10px; color: #fff; background: #30283f; font-size: 25px; cursor: pointer; }
.atlas-story-photo-count { min-width: 85px; text-align: center; font-size: 13px; }
#atlas-story-panel .atlas-story-original { display: inline-block; min-height: 42px; padding: 10px 0; color: var(--atlas-gold, #bba2ff); font-weight: 750; text-decoration: none; }
#atlas-story-panel .atlas-story-linked { display: grid; gap: 5px; margin: 18px 0; padding: 15px; border: 1px solid var(--atlas-line, #49405e); border-radius: 14px; background: var(--atlas-raised, #30283f); }
#atlas-story-panel .atlas-story-linked span { color: var(--atlas-muted, #bbb1d1); font-size: 11px; }
#atlas-story-panel .atlas-story-linked strong { font-size: 15px; }
#atlas-story-panel .atlas-story-place-map { position: relative; height: 188px; margin: 7px 0 2px; border: 1px solid var(--atlas-line, #49405e); border-radius: 11px; overflow: hidden; background: #e9e7df; }
#atlas-story-panel .atlas-story-place-map-surface { position: absolute; inset: 0; }
#atlas-story-panel .atlas-story-place-map-pin { position: absolute; top: 50%; left: 50%; display: grid; width: 30px; height: 30px; place-items: center; transform: translate(-50%, -100%); border: 2px solid #fff; border-radius: 50% 50% 50% 6px; color: #fff; background: #6946df; box-shadow: 0 2px 9px #0008; font-size: 21px; line-height: 1; pointer-events: none; }
#atlas-story-panel .atlas-story-place-map-status { position: absolute; top: 9px; left: 9px; max-width: calc(100% - 18px); padding: 5px 8px; border-radius: 7px; color: #211c32; background: #fffffff0; font-size: 11px; }
#atlas-story-panel .atlas-story-place-map-status[hidden] { display: none; }
#atlas-story-panel .atlas-story-place-map-credit { position: absolute; right: 3px; bottom: 3px; padding: 2px 4px; border-radius: 4px; color: #161322; background: #fffffff2; font-size: 9px; text-decoration: none; }
#atlas-story-panel .atlas-story-linked .atlas-story-place-note { margin: 2px 0 5px; color: var(--atlas-muted, #bbb1d1); font-size: 11px; }
#atlas-story-panel .atlas-story-linked .atlas-story-map-link { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--atlas-gold, #bba2ff); border-radius: 10px; color: #231b39; background: var(--atlas-gold, #bba2ff); font-size: 12px; font-weight: 800; text-align: center; cursor: pointer; }
#atlas-story-panel .atlas-story-linked .atlas-story-map-link:focus-visible { outline: 3px solid var(--atlas-fg, #f4efff); outline-offset: 2px; }
#atlas-story-panel .atlas-story-comment-title { margin: 25px 0 8px; font-size: 15px; }
#atlas-story-panel .atlas-story-comment { border-top: 1px solid var(--atlas-line, #49405e); padding: 13px 0; }
#atlas-story-panel .atlas-story-comment p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#atlas-story-panel .atlas-story-comment-placeholder { color: var(--atlas-muted, #bbb1d1); font-style: italic; }
#atlas-story-panel .atlas-story-comment-form { display: grid; gap: 10px; margin: 18px 0; }
#atlas-story-panel .atlas-story-comment-form label { display: grid; gap: 8px; color: var(--atlas-muted, #bbb1d1); font-size: 12px; font-weight: 740; }
#atlas-story-panel .atlas-story-comment-form textarea { min-height: 90px; width: 100%; padding: 11px 12px; border: 1px solid var(--atlas-line, #49405e); border-radius: 11px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); resize: vertical; }
#atlas-story-panel .atlas-story-compose label { display: grid; gap: 7px; margin: 17px 0; color: var(--atlas-muted, #bbb1d1); font-size: 12px; font-weight: 740; }
#atlas-story-panel .atlas-story-compose input,
#atlas-story-panel .atlas-story-compose textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--atlas-line, #49405e); border-radius: 11px; color: var(--atlas-fg, #f4efff); background: var(--atlas-raised, #30283f); font-size: 16px; }
#atlas-story-panel .atlas-story-compose textarea { min-height: 180px; resize: vertical; }
#atlas-story-panel .atlas-story-compose .atlas-story-place-choice { display: flex; align-items: flex-start; gap: 9px; padding: 13px; border: 1px solid var(--atlas-line, #49405e); border-radius: 12px; background: var(--atlas-raised, #30283f); color: var(--atlas-fg, #f4efff); font-size: 13px; }
#atlas-story-panel .atlas-story-compose .atlas-story-place-choice input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--atlas-gold, #bba2ff); }
#atlas-story-panel .atlas-story-place-note { color: var(--atlas-muted, #bbb1d1); font-size: 12px; }
@media (max-width: 720px) {
  #atlas-story-panel {
    top: calc(140px + env(safe-area-inset-top)); right: 0; left: 0;
    bottom: calc(60px + env(safe-area-inset-bottom));
    width: 100%; height: auto; max-height: none;
    border-radius: 15px 15px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
  }
  #atlas-story-panel .atlas-story-top { padding: 10px 16px; background: var(--atlas-panel, #242033); }
  #atlas-story-panel .atlas-story-eyebrow,
  #atlas-story-panel .atlas-story-subtitle { display: none; }
  #atlas-story-panel .atlas-story-title-row { margin-top: 0; }
  #atlas-story-panel .atlas-story-title { font-size: 18px; letter-spacing: -.04em; }
  #atlas-story-panel .atlas-story-body { padding: 0 16px 8px; }
  #atlas-story-panel .atlas-story-bottom { padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
  #atlas-story-panel .atlas-story-list { gap: 0; margin-top: 5px; }
  #atlas-story-panel .atlas-story-item { padding: 12px 0; }
  #atlas-story-panel .atlas-story-item-title { margin-top: 6px; font-size: 15px; }
  #atlas-story-panel .atlas-story-item-foot { margin-top: 6px; }
  #atlas-story-panel .atlas-story-controls { display: block; padding-top: 9px; }
  #atlas-story-panel .atlas-story-clear-place { display: block; margin: 0; }
  #atlas-story-panel .atlas-story-cities { min-width: 0; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  #atlas-story-panel .atlas-story-city { flex: none; min-height: 38px; padding-inline: 10px; }
  #atlas-story-panel .atlas-story-extra-filters { gap: 8px; margin-top: 8px; }
  #atlas-story-panel .atlas-story-topic { min-width: 0; min-height: 38px; }
  #atlas-story-panel .atlas-story-status { margin-top: 6px; }
}
@media (max-width: 360px) {
  #atlas-story-panel .atlas-story-cities { min-width: 0; gap: 4px; overflow: visible; }
  #atlas-story-panel .atlas-story-city { flex: none; min-width: 0; padding-inline: 7px; font-size: 11px; white-space: nowrap; }
  #atlas-story-panel .atlas-story-topic { padding-inline: 6px; font-size: 11px; }
  #atlas-story-panel .atlas-story-item { padding: 8px 0; }
  #atlas-story-panel .atlas-story-item-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; min-height: 36px; overflow: hidden; font-size: 14px; line-height: 1.35; }
  #atlas-story-panel .atlas-story-item-foot { display: grid; justify-content: start; }
}

/* On short phones, use the map's region-strip space for readable story results. */
@media (max-width: 720px) and (max-height: 640px) {
  #atlas-story-panel { top: calc(94px + env(safe-area-inset-top)); }
  #atlas-story-panel .atlas-story-controls { padding-top: 5px; }
  #atlas-story-panel .atlas-story-city { min-height: 34px; }
  #atlas-story-panel .atlas-story-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #atlas-story-panel .atlas-story-item { padding: 5px 0; }
  #atlas-story-panel .atlas-story-item-title { display: block; overflow: hidden; margin-top: 2px; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; line-height: 1.35; }
  #atlas-story-panel .atlas-story-item-foot { display: flex; margin-top: 2px; }
  #atlas-story-panel .atlas-story-item-kicker { font-size: 10px; }
  #atlas-story-panel .atlas-story-bottom { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  #atlas-story-panel .atlas-story-bottom .atlas-story-primary { min-height: 44px; }
}
