.atlas-page {
  --atlas-background: url('../img/kakera_world_light.webp');
  --atlas-panel-background: rgba(255,250,240,.82);
  background: #eee4d4;
  min-height: 100vh;
  isolation: isolate;
}
/* A fixed layer also keeps the artwork stable on mobile browsers. */
.atlas-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--atlas-background) center center / cover no-repeat;
}
[data-theme="dark"] body.atlas-page {
  --atlas-background: url('../img/kakera_world_dark.webp');
  --atlas-panel-background: rgba(26,29,28,.84);
  background: #1c1e1c;
}
.atlas-page .atlas-intro {
  background: linear-gradient(180deg, rgba(255,250,240,.78), rgba(255,250,240,.62));
}
[data-theme="dark"] .atlas-page .atlas-intro {
  background: linear-gradient(180deg, rgba(26,29,28,.82), rgba(26,29,28,.66));
}
.atlas-page .atlas-footnote {
  padding: 8px 12px;
  border-radius: 5px;
  background: var(--atlas-panel-background);
}
[data-theme="dark"] .atlas-page .atlas-footnote {
  background: var(--atlas-panel-background);
}
.atlas-intro { padding: 48px 0 30px; }
.atlas-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.atlas-eyebrow { color: var(--accent-dark); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; margin: 0 0 12px; }
.atlas-intro h1 { font-size: clamp(32px, 4vw, 48px); margin: 0 0 12px; letter-spacing: .08em; text-align: left; }
.atlas-description { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.9; }
.atlas-lore { padding-top: 25px; color: var(--ink-soft); font-size: 18px; line-height: 2; }
.atlas-lore p { margin: 0 0 10px; }
.atlas-lore p:last-child { color: var(--muted); margin-bottom: 0; }
.atlas-statistics { display: flex; gap: 32px; flex-shrink: 0; padding-bottom: 5px; }
.atlas-statistics div { display: grid; gap: 4px; }
.atlas-statistics strong { font-family: Georgia, serif; font-size: 32px; line-height: 1; font-weight: 400; }
.atlas-statistics span { font-size: 11px; color: var(--muted); letter-spacing: .15em; }
.atlas-workspace { padding: 28px 0 52px; }
.atlas-shell { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); background: transparent; }
.atlas-toolbar, .atlas-place-search, .atlas-status { background: var(--atlas-panel-background); }
.atlas-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.atlas-toolbar-label { color: var(--ink-soft); font-size: 12px; letter-spacing: .12em; }
.atlas-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.atlas-place-search { position: relative; display: flex; gap: 8px; margin: 0; padding: 12px 20px; border-bottom: 1px solid var(--line); }
#atlas-place-query { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 13px; }
.atlas-place-results { position: absolute; top: calc(100% - 6px); left: 20px; right: 20px; max-height: 330px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-sm); z-index: 800; }
.atlas-place-result { display: block; width: 100%; padding: 10px 14px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); text-align: left; cursor: pointer; }
.atlas-place-result:hover, .atlas-place-result:focus-visible { background: var(--surface-soft); }
.atlas-place-result strong { font-size: 14px; }
.atlas-place-result span { display: block; font-size: 11px; color: var(--muted); }
.atlas-place-no-results { padding: 14px; margin: 0; font-size: 13px; color: var(--muted); }
.atlas-streets-visible .leaflet-atlas-labels-pane { visibility: hidden; }
.leaflet-atlas-detail-pane .leaflet-gl-layer { position: absolute; }
.atlas-button { border: 1px solid var(--line); background: transparent; color: var(--ink-soft); border-radius: 5px; padding: 6px 12px; font-size: 12px; line-height: 1.5; cursor: pointer; }
.atlas-button:hover, .atlas-button:focus-visible { background: var(--surface-soft); color: var(--accent-dark); }
.atlas-button:disabled { opacity: .45; cursor: default; }
.atlas-body { display: grid; grid-template-columns: minmax(0, 1fr); }
.atlas-map-wrap { min-width: 0; position: relative; }
#travel-map { height: 620px; width: 100%; background: rgba(190,216,237,.74); z-index: 0; font-family: 'Microsoft YaHei', 'Yu Gothic', sans-serif; }
/* Fade the cartographic surfaces without fading labels, controls or photos. */
.leaflet-atlas-land-pane { opacity: .88; }
.leaflet-atlas-detail-pane { opacity: .88; }
.atlas-streets-visible .leaflet-atlas-land-pane,
.atlas-streets-visible .leaflet-atlas-urban-pane,
.atlas-streets-visible .leaflet-atlas-water-pane,
.atlas-streets-visible .leaflet-atlas-borders-pane,
.atlas-streets-visible .leaflet-atlas-road-casing-pane,
.atlas-streets-visible .leaflet-atlas-roads-pane { visibility: hidden; }
#travel-map.atlas-streets-visible { background: transparent; }
.atlas-place-label { background: transparent; border: 0; pointer-events: none; }
.atlas-pref-name, .atlas-city-name { position: absolute; line-height: 16px; white-space: nowrap; text-shadow: -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff, 1px 1px 1px #fff, 0 0 3px #fff; }
.atlas-pref-name { color: #726c7e; letter-spacing: 1px; font-weight: 500; }
.atlas-city-name { color: #3e474c; font-weight: 400; }
.atlas-city-name.major { color: #26343e; font-weight: 600; }
.atlas-city-dot { position: absolute; width: 4px; height: 4px; left: -2px; top: -2px; border-radius: 50%; background: #6e787c; box-shadow: 0 0 0 1px #fff; }
.atlas-city-dot.major { width: 6px; height: 6px; left: -3px; top: -3px; background: #515d64; box-shadow: 0 0 0 1.5px #fff; }
.atlas-pref-tooltip { font-family: inherit; border: 1px solid #d4d9d1; box-shadow: 0 2px 8px #0001; border-radius: 4px; color: #48514a; }
.atlas-page .leaflet-control-scale { margin-bottom: 10px; }
.atlas-page .leaflet-control-scale-line { font-size: 10px; background: #ffffffbd; color: #4e5b62; border-color: #77868e; }
.atlas-map-caption { position: absolute; left: 14px; bottom: 28px; z-index: 400; padding: 7px 12px; border: 1px solid rgba(116,83,30,.15); border-radius: 5px; background: rgba(255,250,240,.94); color: #5a5149; font-size: 11px; pointer-events: none; }
.atlas-status { margin: 0; padding: 12px 20px; font-size: 12px; color: var(--accent-dark); border-top: 1px solid var(--line); }
.atlas-footnote { display: flex; justify-content: space-between; gap: 15px; flex-wrap: wrap; margin: 15px 2px 0; color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.atlas-footnote a { color: inherit; }
.atlas-page [hidden] { display: none !important; }
.photo-pin { background: transparent; border: 0; }
.photo-pin:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.photo-pin-frame { position: relative; width: 64px; height: 70px; padding: 4px 4px 10px; border-radius: 4px; background: #fffaf0; box-shadow: 0 3px 14px #0004; transform-origin: bottom center; transition: transform .2s; }
.photo-pin:hover .photo-pin-frame, .photo-pin:focus .photo-pin-frame { transform: translateY(-4px) scale(1.08); }
.photo-pin-frame::after { content: ''; position: absolute; bottom: -7px; left: 25px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 7px solid #fffaf0; }
.photo-pin img { width: 56px; height: 56px; display: block; object-fit: cover; border-radius: 2px; }
.photo-pin-fallback { width: 56px; height: 56px; display: grid; place-items: center; background: #e9e1d1; color: #74531e; font-size: 20px; }
.atlas-viewer { width: min(1040px, calc(100% - 40px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px rgba(30,25,18,.22); overflow: auto; }
.atlas-viewer::backdrop { background: rgba(45,40,32,.30); backdrop-filter: blur(5px); }
[data-theme="dark"] .atlas-viewer::backdrop { background: rgba(10,14,12,.48); }
.atlas-viewer-header, .atlas-viewer-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 18px 24px; }
.atlas-viewer-header h2 { margin: 0; font-size: 19px; letter-spacing: .04em; overflow-wrap: anywhere; }
.atlas-viewer-close { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; font-size: 24px; line-height: 1; background: transparent; border: 1px solid var(--line); border-radius: 50%; color: var(--ink-soft); cursor: pointer; padding: 0; }
.atlas-viewer-close:hover, .atlas-viewer-close:focus-visible { background: var(--surface-soft); }
.atlas-viewer figure { margin: 0; }
.atlas-viewer-image-wrap { min-height: 0; background: transparent; display: grid; place-items: center; padding: 0 24px; }
#atlas-photo { display: block; max-width: 100%; width: auto; max-height: min(70dvh, calc(100dvh - 210px)); object-fit: contain; margin: auto; border-radius: 6px; box-shadow: 0 3px 16px rgba(30,25,18,.10); }
#atlas-photo-error { color: var(--ink-soft); padding: 30px; text-align: center; }
.atlas-viewer figcaption { padding: 14px 24px 0; font-size: 14px; }
.atlas-viewer figcaption:empty { display: none; }
.atlas-viewer-footer { font-size: 12px; color: var(--muted); }
.atlas-viewer-footer .atlas-controls { flex-wrap: nowrap; }
.atlas-page .leaflet-control-attribution { color: #333; }
.atlas-page .leaflet-control-attribution a { color: #5b481d; }
@media (max-width: 767px) {
  .atlas-intro { padding: 30px 0 24px; }
  .atlas-lore { font-size: 16px; line-height: 1.9; }
  .atlas-heading { align-items: flex-start; flex-direction: column; gap: 22px; }
  .atlas-statistics { gap: 28px; }
  .atlas-statistics div { display: flex; align-items: baseline; gap: 9px; }
  .atlas-statistics strong { font-size: 24px; }
  #travel-map { height: 450px; height: min(62svh, 500px); min-height: 340px; }
  .atlas-toolbar { padding: 12px; }
  .atlas-map-caption { font-size: 10px; }
  .atlas-viewer-header, .atlas-viewer-footer { padding: 14px; }
  .atlas-viewer { width: calc(100% - 24px); border-radius: 10px; }
  .atlas-viewer-image-wrap { padding: 0 14px; }
  .atlas-viewer figcaption { padding: 12px 14px 0; }
  .atlas-viewer-footer { flex-wrap: wrap; gap: 10px; }
}
