#app .waypoint-map {
  --map-lacquer: #30222aeF;
  --map-gold: #b9946d;
  --map-ink: #fff1d7;
}
#app .waypoint-map .map-wrap { inset: 0; touch-action: none; }
#app .waypoint-map .map-hud { padding-inline: 12px; }
#app .waypoint-map .map-hud .topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: calc(4px + var(--safe-top, 0px)) 0 0; min-height: 0; border: 0; box-shadow: none;
}
#app .waypoint-map .current-region-label { font-size: .92rem; border-radius: 7px; color: var(--map-ink); background: var(--map-lacquer); border-color: var(--map-gold); }
#app .waypoint-map :is(.waypoint-lamp-button,.waypoint-location) {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 48px; min-height: 48px; padding: 6px 8px; border: 1px solid var(--map-gold);
  border-radius: 8px; color: var(--map-ink); background: var(--map-lacquer);
  font-size: .84rem; pointer-events: auto;
}
#app .waypoint-map .waypoint-lamp-button img,#app .waypoint-map .waypoint-location img { width: 22px; height: 22px; object-fit: contain; }
#app .waypoint-map .waypoint-location { position: absolute; right: 12px; bottom: calc(100% + 8px); }
#app .waypoint-map .map-dock {
  position: absolute; z-index: 9; inset: auto 0 0; padding: 8px 12px calc(10px + var(--safe,0px));
  display: grid; grid-template-columns: minmax(0,1fr); gap: 6px;
  background: linear-gradient(160deg,#412c2f,#241821 72%); border-top: 1px solid #c49a70; border-radius: 16px 16px 0 0;
  color: var(--map-ink); box-shadow: 0 -7px 25px #170f1a9e;
}
.waypoint-heading { font-size: .95rem; font-weight: 800; color: #f7dfb7; }
#app .waypoint-map .waypoint-strip { position: relative; display: flex; align-items: stretch; gap: 6px; overflow: auto hidden; touch-action: pan-x; overscroll-behavior-x: contain; scrollbar-width: none; }
#app .waypoint-map .waypoint-strip::-webkit-scrollbar { display: none; }
#app .waypoint-map .waypoint-strip button {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: none;
  min-width: 50px; max-width: min(46vw,180px); min-height: 48px; padding: 8px 9px;
  color: var(--map-ink); background: #33232b; border: 1px solid #a57e5e; border-radius: 8px; box-shadow: none;
  font-size: .9rem; white-space: normal; overflow-wrap: anywhere;
}
#app .waypoint-map .waypoint-strip button span { min-width: 0; font-size: inherit; }
#app .waypoint-map .waypoint-strip .waypoint-goal { min-width: 98px; background: linear-gradient(#f1cc94,#b87d5c); color: #241720; border-color: #f0c98b; }
#app .waypoint-map .waypoint-strip :is(.fast-chip,.is-suggested) { border-color: #ffe3a0; box-shadow: inset 0 0 7px #efb87470; }
#app .waypoint-map .waypoint-strip .is-visited { border-color: #87b1a0; }
#app .waypoint-map .waypoint-strip img { object-fit: contain; flex: 0 0 22px; width: 22px; height: 22px; }
#app .waypoint-map .simple-objective { display: block; min-height: 50px; margin-inline-end: 55px; padding: 6px 9px; background: #2a1d25; border-color: #9c7558; border-radius: 8px; box-shadow: none; }
#app .waypoint-map .simple-objective small { font-size: .74rem; }
#app .waypoint-map .simple-objective strong { font-size: .88rem; overflow-wrap: anywhere; }
#app .waypoint-map .floating-menu { width: 48px; height: 48px; min-width: 48px; min-height: 48px; border-radius: 8px; bottom: calc(11px + var(--safe,0px)); color: var(--map-ink); background: var(--map-lacquer); border-color: var(--map-gold); }
#app .waypoint-map .floating-menu img { width: 27px; height: 27px; object-fit: contain; }
#app .waypoint-map .floating-menu span { display: none; }
#app .waypoint-map .map-world[data-simple-map] .map-point {
  display: flex; gap: 3px; align-items: center; justify-content: center;
  min-width: 48px; min-height: 48px; max-width: 155px; padding: 3px 6px;
  color: var(--map-ink); background: var(--map-lacquer); border: 1px solid var(--map-gold); border-radius: 9px;
  box-shadow: 0 3px 10px #141915ad;
}
#app .waypoint-map .map-point > span { display: grid; place-items: center; background: none; border: 0; box-shadow: none; }
#app .waypoint-map .map-point .map-point-icon { width: 26px; height: 26px; object-fit: contain; }
#app .waypoint-map .map-point .map-pin-name { color: inherit; font-size: .79rem; overflow-wrap: anywhere; white-space: normal; }
#app .waypoint-map .map-point.is-objective { background: linear-gradient(#f3ce96,#b88061); border-color: #ffe2a6; color: #2c1a22; box-shadow: 0 0 15px #ffd991aa; }
#app .waypoint-map .map-point.pin-hidden { visibility: hidden; pointer-events: none; }
#app .waypoint-map .district-npc,#app .waypoint-map :is(.district-treasure,.district-workplace) { min-width: 48px; min-height: 48px; }
#app .waypoint-map .npc-point-icon { width: 16px; height: 16px; }
#modal .waypoint-lamps {
  padding: 8px; border: 1px solid #b58f6a; border-radius: 10px;
  color: #fff1d7; background: linear-gradient(#291b23e6,#291b23f5),url("../assets/world-map-v4.webp") center/cover;
}
#modal .waypoint-lamp-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin: 10px 0; }
#modal .waypoint-lamp-list button { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid #b18a66; border-radius: 7px; background: #38262b; min-width: 0; min-height: 55px; text-align: start; overflow-wrap: anywhere; }
#modal .waypoint-lamp-list button:disabled { opacity: .62; }
#modal .waypoint-lamp-list button img { width: 28px; height: 28px; object-fit: contain; flex: none; }
#modal .waypoint-lamp-list strong,#modal .waypoint-lamp-list small { display: block; white-space: normal; font-size: .85rem; }
#app .simple-map .map-hud .topbar { background: none; border: 0; box-shadow: none; }
#app .simple-map .map-hud .topbar::before,#app .simple-map .map-hud .topbar::after { content: none; }
#app .simple-map .simple-objective .map-discovery-notice { margin: 4px 0 0; color: #ffdda4; overflow-wrap: anywhere; }
#app .waypoint-map .map-point .map-pin-name { word-break: keep-all; }
body:has(.waypoint-map) .toast { top: calc(55px + var(--safe-top,0px)); bottom: auto; }
#modal .modal-box:has(.waypoint-lamps) { background: #261b23; border-color: #bf9a75; box-shadow: 0 -10px 26px #180f18af; }
#modal .waypoint-world-preview { height: 125px; position: relative; isolation: isolate; overflow: hidden; border: 1px solid #a98665; border-radius: 8px; }
#modal .waypoint-world-preview > img { width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(.83) brightness(.82); }
#modal .waypoint-world-preview > span { position: absolute; transform: translate(-50%,-50%); opacity: .5; }
#modal .waypoint-world-preview > span.lit { opacity: 1; filter: drop-shadow(0 0 6px #ffd998); }
#modal .waypoint-lamps .modal-cancel { background: linear-gradient(#ebbd87,#b07b5c); border-color: #efc790; color: #271720; }

/* Transparent HUD chrome and world scenery must never intercept map touches. */
#app .waypoint-map :is(.map-hud,.map-dock,.map-guidance,.district-route,.gate-foreground,.district-avatar,.map-atmosphere,.map-edge-fill,.chapter-light-layer,.district-tap-ring,.boss-pin-state) { pointer-events: none; }
#app .waypoint-map :is(.map-hud,.map-dock) button, #app .waypoint-map .waypoint-strip { pointer-events: auto; }
body:has(.waypoint-map) :is(.toast,#trophy-notice) { pointer-events: none; }
#app .waypoint-map .map-world :is(.map-point,.district-npc,.district-treasure,.district-workplace,.quest-map-spot) { min-width: 48px; min-height: 48px; }
#app .waypoint-map .map-point.pin-label-hidden > .map-pin-name { display: none; }
#app .waypoint-map .map-world .district-treasure { z-index: 40002; }
#app .waypoint-map .map-world button:is(:active,.map-pin-pressed) { filter: drop-shadow(0 0 7px #ffe598); }
#app .waypoint-map .map-world button:is(:active,.map-pin-pressed) :is(.map-point-icon,.treasure-point-icon,.objective-face,.workplace-point-icon) { scale: 1.15; }
html.reduce-motion #app .waypoint-map .map-world button:is(:active,.map-pin-pressed) :is(.map-point-icon,.treasure-point-icon,.objective-face,.workplace-point-icon) { scale: 1; }

/* Keep the quick route readable without showing every footstep. */
@media (prefers-reduced-motion: no-preference) {
  html:not(.reduce-motion) #app .map-fast-glide .district-avatar .explorer-sprite {
    filter: blur(.6px) drop-shadow(-3px 2px 4px #e7c49b66);
    opacity: .86;
  }
}

#app .waypoint-map .waypoint-hud-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#app .waypoint-map .waypoint-hud-actions .waypoint-location { position: static; width: 48px; }
#app .waypoint-map .map-point[data-locked="true"] { opacity: 1; background: #382934; color: #ffebd1; }
#modal:has(.waypoint-lamps) { align-items: center; padding: 10px; }
#modal .modal-box:has(.waypoint-lamps) { width: min(100%,520px); max-height: calc(100dvh - 20px); }
#modal .waypoint-world-preview { height: clamp(160px,41dvh,425px); }
#modal .waypoint-world-preview > img { object-fit: fill; filter: saturate(.92) brightness(.9); }
#app .waypoint-map .waypoint-location span { font-size: .84rem; white-space: nowrap; }
#app .waypoint-map .waypoint-hud-actions .waypoint-location { width: auto; }
#app .waypoint-map .waypoint-hud-actions { justify-content: flex-end; }

#app .waypoint-map .map-world[data-simple-map] .map-point[data-field-boss] {
  display: grid; justify-content: start; grid-template-columns: auto minmax(0, 1fr);
  min-width: 106px; width: max-content; max-width: min(224px, 65vw);
}
#app .waypoint-map .map-point[data-field-boss] > :is(.map-pin-name,.boss-pin-state) {
  grid-column: 2; justify-self: start; white-space: nowrap; word-break: normal;
  overflow-wrap: normal;
}
#app .waypoint-map .map-point[data-field-boss] > .map-pin-name { grid-row: 1; }
#app .waypoint-map .map-point[data-field-boss] > .boss-pin-state { grid-row: 2; font-size: .75rem; }
#app .waypoint-map .objective-copy .wall-prep-note { color: #ffdca4; margin-top: 3px; }
