.world-stage {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: min(100%, calc((100svh - 148px) * var(--map-ratio, 1.75)));
  align-content: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 0 24px;
  overflow: auto;
  background: var(--ink);
}

.world-stage::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--map-backdrop, none) center / cover;
  filter: blur(24px) brightness(.28);
  content: '';
  pointer-events: none;
}

.world-window { position: relative; }
.world-visual { aspect-ratio: var(--map-ratio, 1.75); overflow: hidden; }
.world-shot, .world-shot img { display: block; width: 100%; height: 100%; }
.world-shot img { object-fit: contain; }

.world-locations { position: absolute; inset: 0; }
.world-place {
  position: absolute;
  top: var(--pin-y);
  left: var(--pin-x);
  width: var(--pin-w);
  height: var(--pin-h);
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  padding: 0;
}

.place-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 7px 12px;
  border-bottom: 1px solid #e5c99188;
  border-radius: 2px;
  background: #132329d9;
  color: #fff1d6;
  font-size: clamp(14px, 1.15vw, 18px);
  letter-spacing: .06em;
  text-align: center;
  transition: background .2s, transform .2s;
}

.place-label::before { width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; content: ''; }
.world-place:hover .place-label, .world-place:focus-visible .place-label { background: #263c41; transform: translateY(-2px); }
.world-place:focus-visible { outline: none; }
.world-place:focus-visible .place-label { outline: 2px solid var(--gold); outline-offset: 2px; }
.world-hint, .world-status { margin: 0; padding: 0 16px; text-align: center; color: var(--paper); font-size: 14px; line-height: 1.6; }
html[lang='zh-CN'] .world-hint { font-size: clamp(15px, 1.15vw, 17px); letter-spacing: .06em; }
.world-status { padding: 8px 16px; color: var(--gold); }
body:not([data-world-phase='world']) :is(.world-locations, .world-hint) { visibility: hidden; }

.topbar .wordmark { flex: 1; min-width: 0; margin: 0; font-weight: 500; }
.topbar .quiet-button { white-space: nowrap; }
.topbar .sound-symbol { display: inline-flex; color: var(--paper); }
.topbar .sound-symbol svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#sound[aria-pressed='true'] .sound-muted, #sound[aria-pressed='false'] .sound-waves { display: none; }
body[data-view='world'] #sound { justify-content: center; }
body[data-view='world'] #sound-label { display: none; }

@media (max-width: 760px) {
  body:not([data-view='world']) .topbar .wordmark { display: none; }
  .topbar .sound-symbol { display: none; }
  body[data-view='world'] .topbar .sound-symbol { display: inline-flex; }
}

@media (max-width: 760px) and (orientation: portrait) {
  .world-stage { grid-template-columns: 100%; align-content: start; padding-top: 88px; }
  .world-window { display: grid; gap: 16px; }
  .world-locations { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 16px; }
  .world-place { position: static; width: auto; height: auto; place-items: stretch; }
  .world-place:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .place-label { letter-spacing: .025em; }
}

@media (max-width: 360px) {
  .topbar { padding: 12px; gap: 8px; }
  .topbar .wordmark { font-size: 12px; letter-spacing: .04em; }
  .topbar .wordmark-sub { font-size: 6px; letter-spacing: .02em; }
}

/* The picture and each transparent marker plane use the same intrinsic ratio
   and origin. The visible names stay in normal flow beside or below the map. */
body:is([data-view='world'], [data-view='entering']) .stage { min-height: 0; }

.world-stage.indexed-atlas {
  --atlas-gutter: clamp(12px, 2.4vw, 36px);
  --atlas-gap: clamp(20px, 3vw, 52px);
  --index-width: clamp(220px, 22vw, 340px);
  --map-width: min(calc(100vw - 2 * var(--atlas-gutter) - var(--atlas-gap) - var(--index-width)),
                   calc((100svh - 92px) * var(--map-ratio)));
  grid-template-columns: minmax(0, max-content);
  align-content: safe center;
  gap: 0;
  padding: 76px var(--atlas-gutter) 16px;
}

.indexed-atlas .world-window {
  display: grid;
  grid-template-columns: var(--map-width) var(--index-width);
  align-items: center;
  gap: var(--atlas-gap);
}

.indexed-atlas :is(.world-visual, .book-opening, .place-plane) {
  width: var(--map-width);
  aspect-ratio: var(--map-ratio);
}
.indexed-atlas .world-visual { align-self: start; }

.indexed-atlas .world-locations {
  position: static;
  display: grid;
  gap: 0;
  padding: 0;
}

.indexed-atlas .world-hint {
  grid-column: 1 / -1;
  padding: 0 0 14px;
  color: var(--gold);
  font-size: 16px;
  text-align: start;
}

.indexed-atlas .world-place {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  border-top: 1px solid #d2b17a55;
  text-align: start;
}

.indexed-atlas .place-label {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 10px 4px;
  background: transparent;
  border: 0;
  text-align: start;
  font-size: clamp(16px, 1.25vw, 20px);
  line-height: 1.3;
  letter-spacing: .012em;
  overflow-wrap: anywhere;
}

.indexed-atlas .place-plane {
  position: absolute;
  inset: 0 auto auto 0;
  pointer-events: none;
}

.place-hit {
  position: absolute;
  left: var(--pin-x);
  top: var(--pin-y);
  width: var(--pin-w);
  height: var(--pin-h);
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.place-hit::before, .indexed-atlas .place-label::before {
  display: grid;
  place-items: center;
  flex: none;
  width: 25px;
  height: 25px;
  border: 1px solid #e2c995;
  border-radius: 50%;
  background: #182629;
  color: #fff0cc;
  font: 15px/1 Georgia, serif;
  letter-spacing: 0;
  content: attr(data-number);
}

.place-hit::before { box-shadow: 0 1px 4px #0009; }

.indexed-atlas .world-place:is(:hover, :focus-visible) .place-label {
  background: #172728c9;
  transform: none;
}

.indexed-atlas .world-place:is(:hover, :focus-visible) .place-hit::before {
  background: #f1ddb3;
  color: #142125;
  outline: 2px solid #253432;
}

@media (orientation: landscape) and (max-height: 540px) {
  .world-stage.indexed-atlas { --index-width: clamp(200px, 38vw, 390px); }
  .indexed-atlas .world-hint { font-size: 14px; padding-bottom: 6px; }
  .indexed-atlas .place-label { padding-block: 5px; font-size: 15px; }
}

@media (max-width: 600px), (orientation: portrait) {
  .world-stage.indexed-atlas {
    --map-width: min(calc(100vw - 2 * var(--atlas-gutter)),
                     max(240px, calc((100svh - 278px) * var(--map-ratio))));
    padding-top: 72px;
  }
  .indexed-atlas .world-window { grid-template-columns: var(--map-width); gap: 12px; }
  .indexed-atlas .world-locations { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .indexed-atlas .world-hint { padding-bottom: 8px; font-size: 14px; }
  .indexed-atlas .world-place:last-child:nth-of-type(odd) { grid-column: 1 / -1; }
  .indexed-atlas .place-label { gap: 7px; padding: 5px 2px; font-size: 15px; }
  .indexed-atlas .place-label::before { width: 21px; height: 21px; font-size: 13px; }
}
