#screen-map {
  background: var(--color-bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.map-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1.25rem 10rem;
  gap: 0;
}

.map-node {
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.0625rem;
  color: #fff;
  cursor: pointer;
  position: relative;
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 3px solid rgba(255,255,255,0.15);
  border-bottom-color: rgba(0,0,0,0.3);
  border-right-color: rgba(0,0,0,0.3);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
  touch-action: manipulation;
}

.map-stars {
  font-size: 0.8125rem;
  line-height: 1;
  position: absolute;
  bottom: -0.125rem;
}
.map-stars .star { color: #443366; }
.map-stars .star.found { color: #FFD700; }

/* ── World header labels ─────────────────────────── */
.map-world-header {
  font-family: var(--font-pixel);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #fff;
  padding: 0.5rem 1rem;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.15);
}
.map-world-header.world-1 { color: #AAB8D0; }
.map-world-header.world-2 { color: #66CCFF; }
.map-world-header.world-3 { color: #FF8844; }
.map-world-header.world-4 { color: #BB66FF; }

/* ── Per-world node colors ──────────────────────── */
.map-node.locked {
  background: var(--color-panel);
  color: #443366;
  cursor: not-allowed;
  border-color: #332255;
}

/* World 1 — Castle (stone blue-gray) */
.map-node.world-1.unlocked { background: #5577AA; }
.map-node.world-1.completed { background: #7799CC; }
.map-node.world-1.perfect { background: #AAB8D0; border-color: #fff; }

/* World 2 — Frozen (ice cyan) */
.map-node.world-2.unlocked { background: #2288BB; }
.map-node.world-2.completed { background: #44AADD; }
.map-node.world-2.perfect { background: #66CCFF; border-color: #fff; }

/* World 3 — Ember (fire orange) */
.map-node.world-3.unlocked { background: #CC5522; }
.map-node.world-3.completed { background: #DD7733; }
.map-node.world-3.perfect { background: #FF8844; border-color: #fff; }

/* World 4 — Shadow (dark purple) */
.map-node.world-4.unlocked { background: #6633AA; }
.map-node.world-4.completed { background: #8855CC; }
.map-node.world-4.perfect { background: #BB66FF; border-color: #fff; }

.map-path {
  width: 0.25rem;
  height: 1.75rem;
  background: #332255;
}

.map-path.unlocked { background: rgba(255,255,255,0.3); }

.map-detail {
  background: rgba(10,5,20,0.95);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.125rem 1.125rem calc(1.125rem + env(safe-area-inset-bottom));
  color: var(--color-text);
  text-align: center;
  z-index: 210;
  border-top: 3px solid var(--color-border);
}
.map-detail[hidden] { display: none; }
.map-detail .btn {
  display: flex;
  width: 100%;
  max-width: 16.25rem;
  margin: 0.375rem auto;
  text-align: center;
  box-sizing: border-box;
}

.map-back-btn {
  position: absolute;
  top: calc(0.875rem + env(safe-area-inset-top));
  left: calc(0.875rem + env(safe-area-inset-left));
  z-index: 205;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-panel);
  border: 2px solid var(--color-border);
  cursor: pointer;
  color: #fff;
  font-size: 1.25rem;
  touch-action: manipulation;
}
.map-back-btn:active { transform: translateY(2px); }
