/* ══════════════════════════════════════════════════════
   map.css  —  World Map + Explore Screen
   Supplements style.css
   New visual style: Cinzel serif headings, gold border UI,
   vignette canvas, cinematic map-select overlay.
   ══════════════════════════════════════════════════════ */

/* ── Font variables (augment style.css) ─────────────── */
:root {
  --cinzel:  'Cinzel', serif;
  --crimson: 'Crimson Pro', Georgia, serif;

  /* Explore-screen palette — matches main game's purple/dark theme */
  --ex-accent:     #6050b8;
  --ex-accent2:    #9080e0;
  --ex-ui-bg:      rgba(5, 4, 22, 0.90);
  --ex-ui-border:  rgba(58, 40, 128, 0.45);
  --ex-text:       #d0c8f0;
}

/* ══════════════════════════════════════════════════════
   WORLD MAP SCREEN
   ══════════════════════════════════════════════════════ */

#map-screen {
  min-height: 520px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 20%, #100830 0%, transparent 65%),
    radial-gradient(ellipse 50% 70% at 20% 80%, #060428 0%, transparent 55%),
    #03020c;
  /* display/flex-direction come from .screen/.screen.active — do NOT override here */
  align-items: center;
}

.map-header {
  flex-shrink: 0;
  width: 100%;
  align-self: stretch;
  padding: 16px 22px 12px;
  text-align: center;
  border-bottom: 1px solid #1a1050;
  background: linear-gradient(180deg, rgba(10,5,28,0.9) 0%, transparent 100%);
  z-index: 10;
}

.map-title-label {
  font-family: var(--px);
  font-size: var(--fs-xs);
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: 0 0 20px var(--gold-glow), 0 0 40px #6040c040;
}

.map-arc-label {
  font-family: var(--vt);
  font-size: var(--fs-h3);
  color: #7060b0;
  margin-top: 4px;
  letter-spacing: 2px;
}

/* Responsive Map Wrapper */
.map-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, #1a1040 0%, #060408 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

#map-area {
  position: relative;
  /* Square — constrained by whichever axis is smaller.
     120px budget covers compacted header + info bar + bottom bar. */
  width: min(100%, calc(100vh - 120px));
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  background: url('../images/ui/world_map_bg.png') no-repeat center / cover;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.8), inset 0 0 50px rgba(0,0,0,0.5);
  /* GPU layer — needed for smooth pinch-zoom transform */
  will-change: transform;
  transform-origin: center center;
  touch-action: none;  /* JS handles all touch on the map */
}

.map-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ── Map Pointers (Landmarks) ────────────────────────── */
.map-node {
  position: absolute;
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.map-node:hover, .map-node.kb-focus {
  transform: translate(-50%, -50%) scale(1.2);
  z-index: 10;
}

.map-node.kb-focus .mn-marker {
  box-shadow: 0 0 20px #fff, 0 0 40px var(--gold);
  border-color: #fff;
}

.mn-marker {
  width: 24px;
  height: 24px;
  background: var(--node-color, #6050b8);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: relative;
  box-shadow: 0 0 15px rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.4);
  transition: all 0.3s ease;
}

.mn-marker::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
}

/* States */
.map-node.current .mn-marker {
  box-shadow: 0 0 25px var(--node-color, #6050b8);
  animation: mn-pointer-float 1.5s ease-in-out infinite;
}

@keyframes mn-pointer-float {
  0%, 100% { transform: rotate(-45deg) translateY(0); filter: brightness(1); }
  50% { transform: rotate(-45deg) translateY(-5px); filter: brightness(1.3); }
}

.map-node.done .mn-marker {
  background: #44c060 !important;
  box-shadow: 0 0 12px rgba(68, 192, 96, 0.5);
}

.map-node.next .mn-marker {
  background: var(--gold) !important;
  box-shadow: 0 0 20px var(--gold-glow);
  animation: mn-pointer-next-pulse 2s infinite;
}

@keyframes mn-pointer-next-pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 208, 96, 0.7); }
  70% { box-shadow: 0 0 0 20px rgba(245, 208, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 208, 96, 0); }
}

.map-node.locked {
  opacity: 0.4;
  filter: grayscale(0.8);
  cursor: not-allowed;
}

/* Label tooltip */
.mn-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 5, 25, 0.9);
  border: 1px solid rgba(144, 128, 224, 0.3);
  padding: 4px 10px;
  border-radius: 4px;
  margin-top: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.map-node:hover .mn-label, .map-node.current .mn-label {
  opacity: 1;
}

.mn-status {
  font-family: var(--px);
  font-size: var(--fs-xxs);
  letter-spacing: 0.5px;
  color: #3a2860;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.map-node.done .mn-status   { color: #44c060; }
.map-node.current .mn-status { color: var(--gold); }
.map-node.next .mn-status   { color: #60a8f0; }
.map-node.charted .mn-status { color: #6090a0; }

.mn-name {
  font-family: var(--vt);
  font-size: 14px;
  color: #fff;
  letter-spacing: 1px;
}

/* Party indicator */
.mn-party-indicator {
  position: absolute;
  top: -15px;
  right: -15px;
  font-size: 20px;
  filter: drop-shadow(0 0 8px var(--gold));
  animation: mn-party-float 2s ease-in-out infinite;
}

@keyframes mn-party-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ── Region Detail Panel (right slide-in) ────────────── */
.map-region-panel {
  position: absolute;
  top: 80px;
  right: -400px;
  width: 320px;
  max-height: calc(100% - 160px);
  background: rgba(10, 5, 25, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(144, 128, 224, 0.4);
  border-right: none;
  box-shadow: -10px 0 30px rgba(0,0,0,0.8);
  z-index: 50;
  transition: right 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  color: #fff;
  border-radius: 8px 0 0 8px;
  overflow: hidden;
}

.map-region-panel.open {
  right: 0;
}

/* Drag handle — only visible when panel is a bottom sheet (≤600px) */
.mrp-handle {
  display: none;
  width: 40px;
  height: 4px;
  background: rgba(144, 128, 224, 0.35);
  border-radius: 2px;
  margin: 10px auto 4px;
  flex-shrink: 0;
  cursor: grab;
}
@media (max-width: 800px) {
  .mrp-handle { display: block; }
}

.mrp-num {
  font-family: var(--px);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 4px;
  padding: 20px 20px 0;
}

.mrp-name {
  font-family: var(--vt);
  font-size: 26px;
  letter-spacing: 1px;
  padding: 0 20px;
}

.mrp-loc {
  font-family: var(--px);
  font-size: 11px;
  color: #8080c0;
  margin-top: 4px;
  padding: 0 20px;
}

.mrp-shard {
  font-family: var(--vt);
  font-size: 15px;
  margin: 4px 20px;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mrp-lore {
  font-family: var(--crimson);
  font-size: 16px;
  line-height: 1.6;
  color: #d0d0f0;
  padding: 8px 20px;
  flex: 1;
  overflow-y: auto;
}

.mrp-actions {
  padding: 15px 20px 25px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0,0,0,0.3);
}

.mrp-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 12px;
  font-family: var(--px);
  font-size: 12px;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  text-align: center;
}

.mrp-btn:hover, .mrp-btn.kb-focus {
  background: rgba(255,255,255,0.1);
  border-color: var(--ex-accent2);
  outline: none;
}

.mrp-btn.kb-focus {
  box-shadow: 0 0 10px var(--ex-accent2);
}

.mrp-btn.primary {
  background: var(--ex-accent);
  border-color: var(--ex-accent2);
  font-weight: bold;
}

.mrp-btn.primary:hover {
  background: var(--ex-accent2);
  box-shadow: 0 0 15px var(--ex-accent2);
}

.mrp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* Map info bar */
.map-info-bar {
  flex-shrink: 0;
  width: 100%;
  align-self: stretch;
  padding: 10px 22px 8px;
  text-align: center;
  min-height: 52px;
  border-top: 1px solid #12102040;
}

.map-info-name {
  font-family: var(--px);
  font-size: var(--fs-sm);
  color: #c0b0e8;
  letter-spacing: 2px;
}

.map-info-loc {
  font-family: var(--vt);
  font-size: var(--fs-md);
  color: #5040a0;
  margin-top: 3px;
  letter-spacing: 1px;
}

/* ══════════════════════════════════════════════════════
   EXPLORE SCREEN
   ══════════════════════════════════════════════════════ */

#explore-screen {
  height: 100%;
  min-height: 500px;
  background: #06040e;
}

/* ── Cinematic header bar ────────────────────────────── */
.explore-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 48px;
  background: linear-gradient(180deg, rgba(5,4,22,0.98) 0%, rgba(5,4,22,0) 100%);
  position: relative;
  z-index: 20;
  border-bottom: 1px solid #1a0d40;
}

.explore-header-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.explore-map-name {
  font-family: var(--vt);
  font-size: var(--fs-h3);
  color: var(--ex-text);
  letter-spacing: 3px;
  text-shadow: 0 0 14px rgba(144,128,224,0.5);
}

.explore-map-hint {
  font-family: var(--vt);
  font-size: var(--fs-sm);
  color: rgba(90, 82, 122, 0.75);
  letter-spacing: 1px;
}

.explore-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.explore-back-btn, .explore-menu-btn {
  font-family: var(--px);
  font-size: var(--fs-xs);
  letter-spacing: 1px;
  padding: 6px 12px;
  background: var(--ex-ui-bg);
  border: 1px solid var(--ex-ui-border);
  color: var(--ex-text);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
  white-space: nowrap;
}
.explore-back-btn:hover, .explore-menu-btn:hover {
  background: rgba(96,80,184,0.15);
  border-color: var(--ex-accent2);
  color: #fff;
  text-shadow: 0 0 10px rgba(144,128,224,0.6);
}

/* ── PAUSE MENU OVERLAY ──────────────────────────────── */
#map-pause-menu {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgba(4, 2, 10, 0.6);
  backdrop-filter: var(--blur);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pause-panel {
  background: var(--glass);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-hi);
  border-radius: var(--r);
  padding: 22px 24px;
  width: min(560px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--glow-soft);
}

.pause-title {
  font-family: var(--px);
  font-size: var(--fs-sm);
  letter-spacing: 3px;
  color: var(--ex-accent2);
  text-align: center;
  border-bottom: 1px solid #1a0d40;
  padding-bottom: 10px;
}

.pause-party {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pause-member {
  background: rgba(144, 128, 255, 0.04);
  border: 1px solid rgba(144, 128, 255, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pause-member.ko-member    { opacity: 0.4; filter: grayscale(0.8); }
.pause-member.active-member { border-color: #6040c0; box-shadow: 0 0 8px #6040c040; }

.pm-header  { display: flex; justify-content: space-between; align-items: baseline; }
.pm-name    { font-family: var(--px); font-size: var(--fs-sm); }
.pm-lv      { font-size: var(--fs-xs); color: #d8c860; }

.pm-exp-line { font-size: var(--fs-xs); color: #6060a0; margin-bottom: 1px; }

.pm-hp-bar-bg   { height: 7px; background: #1a1030; border-radius: 2px; }
.pm-hp-bar-fill { height: 100%; border-radius: 2px; transition: width .3s; }
.pm-mp-bar-bg   { height: 5px; background: #0a0820; border-radius: 2px; margin-top: 2px; }
.pm-mp-bar-fill { height: 100%; background: #4080e0; border-radius: 2px; }

.pm-bar-label    { font-size: var(--fs-xs); color: #a0a0c0; text-align: right; }
.pm-bar-label.mp { color: #6080c0; }

.pm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: var(--fs-xs);
  color: #8888aa;
  margin-top: 2px;
}
.pm-stats span  { color: #c0b8e0; font-size: var(--fs-sm); }
.pm-status-ok   { color: #4ade80; font-size: var(--fs-xs); }
.pm-status-ko   { color: #ef4444; font-size: var(--fs-xs); }

.pm-passive {
  font-size: var(--fs-xs);
  color: #7060a8;
  border-top: 1px solid #1a1040;
  padding-top: 6px;
  margin-top: 2px;
  line-height: 1.6;
}

.pause-section-label {
  font-family: var(--px);
  font-size: var(--fs-xs);
  letter-spacing: 2px;
  color: #6050a0;
  margin-bottom: 6px;
}

.pause-inv-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pause-inv-slot {
  background: rgba(144, 128, 255, 0.05);
  border: 1px solid rgba(144, 128, 255, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--ex-text);
  transition: all .2s;
}
.pause-inv-slot .pi-qty          { color: #d8c860; font-size: var(--fs-xxs); }
.pause-inv-slot.map-usable       { cursor: pointer; border-color: #4a3880; }
.pause-inv-slot.map-usable:hover { background: rgba(100,80,200,0.18); border-color: #9080e0; }
.pause-inv-empty                 { font-size: var(--fs-xs); color: #403860; font-style: italic; }

/* Map item target picker */
.map-item-picker {
  background: rgba(5,4,22,0.96);
  border: 1px solid #3a2880;
  border-radius: 6px;
  padding: 8px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mip-title { font-size: var(--fs-xs); color: #9080e0; margin-bottom: 2px; }
.mip-member-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid #3a2880;
  border-radius: 4px;
  color: #d0c8f0;
  font-size: var(--fs-xs);
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.mip-member-btn:hover { background: rgba(100,80,200,0.2); }
.mip-hp { color: #6080c0; font-size: var(--fs-xxs); }
.mip-cancel {
  background: transparent;
  border: 1px solid #3a1840;
  border-radius: 4px;
  color: #804060;
  font-size: var(--fs-xxs);
  padding: 3px 6px;
  cursor: pointer;
  align-self: flex-start;
  margin-top: 2px;
}
.mip-cancel:hover { color: #ef4444; border-color: #ef4444; }

/* Pause action buttons */
.pause-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  border-top: 1px solid #1a0d40;
  padding-top: 12px;
}

.pause-btn {
  font-family: var(--px);
  font-size: var(--fs-xs);
  letter-spacing: 1px;
  padding: 10px 20px;
  background: rgba(40,20,80,0.6);
  border: 1px solid #2a1860;
  color: #c0b0e8;
  cursor: pointer;
  border-radius: 4px;
  transition: all .18s;
}
.pause-btn:hover           { background: rgba(80,50,160,0.4); border-color: #6040c0; color: #fff; }
.pause-btn.save-btn        { border-color: #2060a0; color: #80c0ff; }
.pause-btn.save-btn:hover  { background: rgba(20,60,120,0.5); border-color: #4090d0; }

/* ── NPC Dialogue ────────────────────────────────────── */
#npc-dialogue {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 16px;
  z-index: 55;
  background: rgba(2,1,8,0.55);
  backdrop-filter: blur(2px);
}

/* ── NPC Scene Layer — chibi half-sprite, one active speaker at a time */
.npc-scene-layer {
  display: flex;
  align-items: flex-end;
  width: min(560px, 96vw);
  flex-shrink: 0;
  pointer-events: none;
  /* negative margin: 30% of sprite height hides behind panel, 70% visible */
  margin-bottom: -46px;
  position: relative;
  z-index: 0;
}

.npc-scene-char {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

/* Party speaker: left edge */
.npc-scene-char.npc-side-left  { margin-right: auto; padding-left: 8px; }
/* NPC speaker: right edge */
.npc-scene-char.npc-side-right { margin-left: auto;  padding-right: 8px; }

.npc-scene-sprite {
  display: block;
  flex-shrink: 0;
}

/* Landscape phones — PWA primary target */
@media (orientation: landscape) and (max-height: 500px) {
  .npc-scene-layer { margin-bottom: -30px; }
}

/* Tablet+ — subtle glow on active chibi */
@media (min-width: 600px) {
  .npc-scene-layer { width: min(760px, 90vw); }
  .npc-scene-char .npc-scene-sprite {
    filter: drop-shadow(0 0 10px rgba(160, 144, 208, 0.45));
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .npc-scene-layer { margin-bottom: -60px; }
}

/* Small mobile — compact text panel */
@media (max-width: 480px) {
  .npc-dialogue-panel {
    padding: 10px 14px;
    gap: 7px;
  }
  .npc-dialogue-name  { font-size: 0.78rem; letter-spacing: 1.5px; }
  .npc-dialogue-text  { font-size: 0.82rem; min-height: 36px; line-height: 1.5; }
  .npc-dialogue-next  { font-size: 0.75rem; padding: 7px 14px; }
  .npc-dialogue-header { padding-bottom: 5px; }
  .npc-dialogue-footer { padding-top: 5px; }
}

.npc-dialogue-panel {
  background: rgba(10, 6, 28, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(96, 80, 184, 0.35);
  border-radius: 12px;
  padding: 18px 22px;
  width: min(560px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(96, 80, 184, 0.1);
  position: relative;
  z-index: 1;
}

.npc-dialogue-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #1a0d40;
  padding-bottom: 8px;
}


.npc-dialogue-name {
  font-family: var(--px);
  font-size: var(--fs-md);
  letter-spacing: 2px;
  color: #c4b5fd;
}

.npc-dialogue-text {
  font-size: var(--fs-md);
  color: #e8e0f8;
  line-height: 1.6;
  font-style: italic;
  min-height: 52px;
}

.npc-dialogue-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #1a0d40;
  padding-top: 8px;
}

.npc-dialogue-next {
  font-family: var(--px);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  padding: 10px 24px;
  background: rgba(80,40,160,0.6);
  border: 1px solid #5030a0;
  color: #d8c8ff;
  cursor: pointer;
  border-radius: 4px;
  transition: all .15s;
}
.npc-dialogue-next:hover { background: rgba(100,60,200,0.4); border-color: #7c3aed; color: #fff; }

/* ── Quest choice buttons (accept / dismiss / collect reward) ── */
.npc-dialogue-choices {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
  margin-bottom: 6px;
}

.npc-choice-btn {
  font-family: var(--px);
  font-size: var(--fs-sm);
  letter-spacing: 1.5px;
  padding: 9px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.npc-choice-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.npc-choice-btn.primary {
  background: rgba(200, 164, 90, 0.12);
  border-color: rgba(200, 164, 90, 0.45);
  color: var(--gold);
}
.npc-choice-btn.primary:hover {
  background: rgba(200, 164, 90, 0.22);
  border-color: var(--gold);
  color: #fff5cc;
}

/* Compact for small phones */
@media (max-width: 480px) {
  .npc-choice-btn { font-size: 9px; padding: 7px 14px; letter-spacing: 1px; }
}
/* Compact for landscape phones */
@media (orientation: landscape) and (max-height: 500px) {
  .npc-choice-btn { font-size: 8px; padding: 6px 12px; }
}

/* ── PC / large-screen dialogue scaling ─────────────── */
@media (min-width: 1024px) {
  .npc-dialogue-panel {
    width: min(820px, 92vw);
    padding: 30px 38px;
    gap: 20px;
  }
  .npc-dialogue-name {
    font-size: 1.5rem;
    letter-spacing: 3px;
  }
  .npc-dialogue-text {
    font-size: 1.3rem;
    min-height: 90px;
    line-height: 1.75;
  }
  .npc-dialogue-next {
    font-size: 1.1rem;
    padding: 14px 40px;
  }
}

/* ── Camp Menu ───────────────────────────────────────── */
#camp-menu {
  position: absolute;
  inset: 0;
  background: rgba(4,2,12,0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  backdrop-filter: blur(6px);
}

.camp-panel {
  background: linear-gradient(160deg, rgba(16, 10, 46, 0.97) 0%, rgba(8, 5, 20, 0.99) 100%);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(110, 90, 200, 0.4);
  border-radius: 14px;
  padding: 26px 30px 22px;
  width: min(340px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 0 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(80,60,160,0.15),
              inset 0 0 24px rgba(96,80,184,0.08);
}

.camp-title {
  font-family: var(--px);
  font-size: var(--fs-md);
  letter-spacing: 4px;
  color: var(--ex-accent2);
  text-align: center;
  text-shadow: 0 0 20px rgba(150,120,255,0.5);
}

.camp-subtitle {
  font-size: var(--fs-xs);
  color: #7060a8;
  text-align: center;
  margin-top: -8px;
}

.camp-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid rgba(60,40,100,0.6);
  padding-top: 14px;
}

.camp-btn {
  font-family: var(--px);
  font-size: var(--fs-sm);
  letter-spacing: 1.5px;
  padding: 12px 18px;
  background: rgba(36,18,76,0.7);
  border: 1px solid rgba(60,40,120,0.7);
  color: #c0b0e8;
  cursor: pointer;
  border-radius: 7px;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}
.camp-btn:hover  { background: rgba(80,50,160,0.5); border-color: #7050d0; color: #fff; }
.camp-btn:active { transform: scale(0.97); }
.camp-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
}

.camp-btn-minor {
  background: transparent;
  border-color: rgba(40,25,80,0.5);
  color: #5a4890;
  font-size: var(--fs-xxs);
  letter-spacing: 1px;
  padding: 8px 18px;
  justify-content: center;
  margin-top: 2px;
}
.camp-btn-minor:hover { color: #a090d0; border-color: #4a3080; background: rgba(40,20,80,0.3); }

/* ── Relic Panel ─────────────────────────────────────── */
#relic-panel {
  position: absolute;
  inset: 0;
  background: rgba(4,2,12,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.relic-panel-inner {
  background: linear-gradient(160deg, rgba(14, 10, 42, 0.96) 0%, rgba(6, 4, 18, 0.99) 100%);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(160, 140, 255, 0.25);
  border-radius: 12px;
  padding: 20px 22px;
  width: min(360px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
}

.relic-panel-title {
  font-family: var(--px);
  font-size: var(--fs-md);
  letter-spacing: 3px;
  color: #d4af37;
  text-align: center;
}

.relic-panel-subtitle {
  font-size: var(--fs-xs);
  color: #6050a0;
  text-align: center;
  margin-top: -4px;
}

.relic-panel-label {
  font-family: var(--px);
  font-size: var(--fs-xxs);
  letter-spacing: 2px;
  color: #4a3880;
  margin-top: 4px;
}

.relic-slots-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  border: 1px solid #1a0d40;
  border-radius: 6px;
  padding: 10px;
  background: rgba(0,0,0,0.3);
}

.relic-slot {
  width: 76px;
  min-height: 76px;
  border: 1px dashed #3a2870;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  font-size: var(--fs-xxs);
  color: #6050a0;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}

.relic-slot.filled {
  border-color: #d4af37;
  color: #d4af37;
  background: rgba(212,175,55,0.06);
}
.relic-slot.filled:hover { background: rgba(212,175,55,0.14); }

.relic-slot-icon { font-size: 1.4rem; }
.relic-slot-name { font-size: var(--fs-xxs); letter-spacing: 0.5px; line-height: 1.3; }

.relic-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.active-tag {
  position: absolute;
  top: 6px; right: 6px;
  font-family: var(--px);
  font-size: var(--fs-xxs);
  padding: 2px 6px;
  background: #d4af37;
  color: #000;
  border-radius: 3px;
}

/* ── Canvas wrap ─────────────────────────────────────── */
#explore-canvas-wrap {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #050210;
}

#explore-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  image-rendering: auto;
}

/* ── Bond Panel ──────────────────────────────────────── */
#bond-panel {
  position: absolute;
  inset: 0;
  background: rgba(4, 2, 12, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.bond-panel-inner {
  background: linear-gradient(160deg, rgba(20, 10, 50, 0.97) 0%, rgba(6, 4, 18, 0.99) 100%);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(180, 120, 255, 0.28);
  border-radius: 14px;
  padding: 22px 24px 18px;
  width: min(400px, 96vw);
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 0 60px rgba(140, 60, 255, 0.18), 0 0 120px rgba(0, 0, 0, 0.7);
}

.bond-panel-title {
  font-family: var(--px);
  font-size: var(--fs-md);
  letter-spacing: 4px;
  color: #d4af37;
  text-align: center;
  text-shadow: 0 0 18px rgba(212, 175, 55, 0.5);
}

.bond-panel-subtitle {
  font-size: var(--fs-xs);
  color: #5a4880;
  text-align: center;
  margin-top: -8px;
}

.bond-pairs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.bp-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.bp-card.bp-available {
  border-color: rgba(168, 85, 247, 0.55);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.18);
  animation: bp-pulse 2.4s ease-in-out infinite;
}

@keyframes bp-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(168, 85, 247, 0.18); }
  50%       { box-shadow: 0 0 28px rgba(168, 85, 247, 0.38); }
}

.bp-card.bp-complete {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.12);
}

.bp-card.bp-inactive {
  opacity: 0.45;
}

.bp-chars-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.bp-char {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.bp-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-char-name {
  font-family: var(--px);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-align: center;
}

.bp-link {
  font-size: 16px;
  color: rgba(212, 175, 55, 0.6);
  margin: 0 2px;
}

.bp-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  text-align: center;
}

.bp-tier-label {
  font-family: var(--px);
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(180, 160, 255, 0.7);
}

.bp-pips {
  display: flex;
  gap: 6px;
  margin: 2px 0;
}

.bp-pip {
  width: 24px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.3s;
}

.bp-pip.filled {
  background: linear-gradient(90deg, #a855f7, #ec4899);
  border-color: #f472b6;
  box-shadow: 0 0 6px rgba(236, 72, 153, 0.5);
}

.bp-tier-name {
  font-size: var(--fs-xs);
  color: #c4b5fd;
  font-style: italic;
}

.bp-cta {
  font-size: var(--fs-xxs);
  color: #a855f7;
  letter-spacing: 1px;
}

.bp-next-req {
  font-size: var(--fs-xxs);
  color: rgba(144, 128, 200, 0.55);
  letter-spacing: 0.5px;
}

.bp-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-top: 2px;
}

.bp-reward {
  font-size: 9px;
  letter-spacing: 0.5px;
  color: #d4af37;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 4px;
  padding: 2px 7px;
}

.bp-absent {
  font-size: var(--fs-xxs);
  color: rgba(144, 128, 200, 0.4);
  font-style: italic;
}

/* ── Map select overlay — cinematic ──────────────────── */
#map-select-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(18,10,40,0.94) 0%, rgba(6,4,14,0.99) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  z-index: 10;
}

.map-sel-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.map-sel-crest {
  font-size: 2.2rem;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 16px rgba(200,164,90,0.5));
  animation: float 3s ease-in-out infinite;
}

.map-sel-title {
  font-family: var(--px);
  font-size: var(--fs-sm);
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: 0 0 20px var(--gold-glow);
  text-align: center;
  margin-bottom: 6px;
}

.map-sel-sub {
  font-family: var(--vt);
  font-size: var(--fs-md);
  color: rgba(160, 148, 220, 0.55);
  letter-spacing: 2px;
  margin-bottom: 28px;
}

.map-sel-inner::after {
  content: '';
  display: block;
  width: 180px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96,80,184,0.5), transparent);
  margin: -20px 0 20px;
}

.map-sel-btn {
  font-family: var(--px);
  font-size: var(--fs-sm);
  letter-spacing: 2px;
  color: var(--ex-text);
  background: rgba(5, 4, 22, 0.88);
  border: 1px solid var(--ex-ui-border);
  padding: 14px 40px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 260px;
  text-align: center;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.map-sel-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(96,80,184,0.12), transparent);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}
.map-sel-btn:hover::before { transform: translateX(100%); }

.map-sel-btn:hover {
  border-color: var(--ex-accent2);
  background: rgba(96, 80, 184, 0.15);
  color: #fff;
  text-shadow: 0 0 12px rgba(144,128,224,0.6);
}

/* ── Encounter flash (ember vignette) ────────────────── */
#explore-flash {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center,
    rgba(224,96,48,0) 25%,
    rgba(224,96,48,0.65) 100%);
  transition: opacity 0.08s ease;
}
#explore-flash.show { opacity: 1; }

#explore-flash.corrupted-flash {
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0.45) 0%, transparent 55%),
    radial-gradient(ellipse at center, rgba(160,20,255,0) 28%, rgba(160,20,255,0.80) 100%);
  animation: flashPulseCorrupt 0.75s ease-out forwards;
}
#explore-flash.mutant-flash {
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0.40) 0%, transparent 50%),
    radial-gradient(ellipse at center, rgba(30,255,70,0) 28%, rgba(30,255,70,0.75) 100%);
  animation: flashPulseMutant 0.75s ease-out forwards;
}
@keyframes flashPulseCorrupt {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  60%  { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes flashPulseMutant {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  60%  { opacity: 0.80; }
  100% { opacity: 0; }
}

/* ── Mutated enemy battle sprites ────────────────────── */
.enemy-corrupted {
  filter: hue-rotate(220deg) saturate(2.4) brightness(0.9) !important;
  transform: scale(1.28) !important;
  transform-origin: bottom center;
  animation: corrupt-pulse 1.8s ease-in-out infinite;
}
.enemy-mutant {
  filter: hue-rotate(105deg) saturate(3.2) brightness(1.2) contrast(1.35) !important;
  transform: scale(1.60) !important;
  transform-origin: bottom center;
  animation: mutant-pulse 0.9s ease-in-out infinite;
}
@keyframes corrupt-pulse {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(160,40,255,0.5); }
  50%       { box-shadow: 0 0 20px 6px rgba(160,40,255,0.9); }
}
@keyframes mutant-pulse {
  0%, 100% { box-shadow: 0 0 10px 3px rgba(60,255,80,0.5); filter: hue-rotate(105deg) saturate(3.2) brightness(1.2) contrast(1.35) !important; }
  50%       { box-shadow: 0 0 24px 8px rgba(60,255,80,0.9); filter: hue-rotate(120deg) saturate(4.0) brightness(1.4) contrast(1.5) !important; }
}

/* ── Notification banner ─────────────────────────────── */
#explore-notif {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(5, 4, 22, 0.92);
  border: 1px solid rgba(96, 80, 184, 0.5);
  border-top: 2px solid var(--ex-accent2);
  padding: 9px 26px;
  font-family: var(--px);
  font-size: var(--fs-xs);
  letter-spacing: 2px;
  color: var(--ex-text);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(144,128,224,0.5);
}
#explore-notif.show { opacity: 1; }

/* ── Corruption meter (top-right of canvas wrap) ─────── */
#corruption-meter {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: none;
}

#corruption-label {
  font-family: var(--px);
  font-size: 8px;
  letter-spacing: 2px;
  color: #9ca3af;
  transition: color 0.4s;
}

#corruption-track {
  width: 100px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

#corruption-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: hsl(120, 70%, 52%);
  transition: width 0.6s ease, background 0.6s ease, opacity 0.3s;
}

#corruption-meter.corruption-danger #corruption-track {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.35);
  animation: corruption-pulse 1.2s ease-in-out infinite;
}

@keyframes corruption-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(168, 85, 247, 0.3); }
  50%       { box-shadow: 0 0 14px rgba(168, 85, 247, 0.6); }
}

/* ── Party HUD (bottom-left of canvas wrap) ──────────── */
#explore-party-hud {
  position: absolute;
  bottom: 44px;
  left: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.ex-hud-member {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 12, 45, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(144, 128, 255, 0.12);
  border-left: 3px solid var(--ex-accent);
  padding: 6px 12px 6px 8px;
  min-width: 170px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: slideRightHUD 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes slideRightHUD {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.ex-hud-member:hover {
  background: rgba(144, 128, 255, 0.1);
  border-color: rgba(144, 128, 255, 0.3);
  transform: translateX(4px);
}
.ex-hud-member.ex-hud-active {
  background: rgba(144, 128, 255, 0.16);
  border-left-color: #c8a4ff;
  box-shadow: inset 0 0 12px rgba(180, 140, 255, 0.1);
}

.ex-hud-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(96, 80, 184, 0.15);
  border: 1px solid rgba(96, 80, 184, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm);
  flex-shrink: 0;
}

.ex-hud-info { flex: 1; min-width: 0; }

.ex-hud-name {
  font-family: var(--px);
  font-size: var(--fs-xxs);
  letter-spacing: 1px;
  color: var(--ex-text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-hud-bar-wrap {
  height: 5px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ex-hud-bar-fill {
  height: 100%;
  transition: width 0.4s ease, background 0.4s ease;
  position: relative;
}
.ex-hud-bar-fill::after {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 3px;
  background: rgba(255,255,255,0.55);
}

.ex-hud-hp {
  font-family: var(--vt);
  font-size: var(--fs-sm);
  color: rgba(160, 148, 220, 0.6);
  margin-top: 2px;
}

/* ── Mobile Controls (Joystick & Action Buttons) ─────── */
#joystick-container {
  display: none;
}

@media (pointer: coarse) {
  #joystick-container {
    position: absolute;
    bottom: calc(28px + 30px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    height: 140px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    pointer-events: none;
    z-index: 1000;
  }
}

.joystick-left, .joystick-right {
  pointer-events: auto;
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.joystick-base {
  width: 80px;
  height: 80px;
  background: rgba(144, 128, 255, 0.08);
  border: 2px solid rgba(144, 128, 255, 0.2);
  border-radius: 50%;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  position: relative;
  touch-action: none;
  box-shadow: inset 0 0 12px rgba(144, 128, 255, 0.1);
}

.joystick-knob {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #7050d8, #4030a0);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), 0 0 8px rgba(112, 80, 216, 0.5);
  pointer-events: none;
  will-change: transform;
}

.joystick-right {
  width: 110px;
  height: 110px;
}

.action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  position: absolute;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  transition: transform 0.1s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-x {
  background: rgba(184, 100, 255, 0.15);
  border-color: rgba(184, 100, 255, 0.4);
  bottom: 0px; right: 0px;
  text-shadow: 0 0 10px rgba(184, 100, 255, 0.8);
}
.btn-y {
  background: rgba(0, 242, 255, 0.15);
  border-color: rgba(0, 242, 255, 0.4);
  top: 0px; left: 10px;
  text-shadow: 0 0 10px rgba(0, 242, 255, 0.8);
}
.action-btn:active { transform: scale(0.9) translateY(4px); background: rgba(255,255,255,0.2); }

/* ── Minimap (top-right of canvas wrap) ──────────────── */
#explore-minimap-wrap {
  position: absolute;
  top: 8px;
  right: 14px;
  bottom: auto;
  z-index: 20;
  background: rgba(10, 8, 38, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(144, 128, 255, 0.15);
  border-top: 3px solid var(--ex-accent);
  padding: 11px;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slideUpHUD 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes slideUpHUD {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ex-minimap-label {
  font-family: var(--px);
  font-size: var(--fs-xxs);
  letter-spacing: 2px;
  color: rgba(144, 128, 224, 0.6);
  text-align: center;
  margin-bottom: 5px;
  text-transform: uppercase;
}

#explore-minimap { display: block; }

/* ── Floating Objective Banner ─────────────────────────── */
.explore-loc-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 32px;
  background: rgba(10, 8, 38, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(144, 128, 255, 0.25);
  border-radius: 30px;
  height: auto;
  min-width: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 16px rgba(144, 128, 255, 0.1);
  z-index: 100;
  transition: all 0.3s ease;
  pointer-events: none;
}

#explore-loc {
  font-family: var(--vt);
  font-size: var(--fs-md);
  color: #c0b0e8;
  letter-spacing: 1.5px;
  text-shadow: 0 0 10px rgba(144, 128, 255, 0.3);
  text-align: center;
  white-space: nowrap;
}

#explore-loc.complete {
  color: #4ade80;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — map.css overrides
   Lives here because map.css loads AFTER style.css.
   ══════════════════════════════════════════════════════════ */

/* ── Landscape phones (h ≤ 500px) — installed PWA primary target ── */
@media (orientation: landscape) and (max-height: 500px) {
  #map-screen     { min-height: 0; }
  #explore-screen { min-height: 0; }

  /* Compact map chrome — reclaim vertical space for the map itself */
  .map-header      { padding: 3px 14px; }
  .map-title-label { font-size: 8px; letter-spacing: 2px; }
  .map-arc-label   { display: none; }
  .map-info-bar    { min-height: 0; padding: 3px 14px 2px; }
  .map-info-name   { font-size: var(--fs-xs); }
  .map-info-loc    { display: none; }
  .map-bottom-bar  { padding: 0 10px calc(2px + env(safe-area-inset-bottom)); }
  .map-bottom-bar .big-btn { padding: 7px 14px; font-size: 11px; }
  .map-party-btn   { padding: 7px 10px; font-size: 10px; }

  /* Tighter map size budget now that chrome is compacted (~80px total) */
  #map-area { width: min(100%, calc(100vh - 80px)); }

  /* Explore header */
  .explore-header   { padding: 4px 12px; background: rgba(10, 5, 25, 0.7); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(160, 140, 255, 0.2); }
  .explore-map-name { font-size: 11px; }
  .explore-map-hint { font-size: 9px; }
  .explore-menu-btn { font-size: 9px; padding: 4px 10px; }

  .pm-mp-bar-bg   { background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
  .pm-mp-bar-fill { background: linear-gradient(90deg, #4a90e2, #8e44ad) !important; height: 6px; transition: width 0.3s ease; }
}

/* ── Safe area — Android nav bar in standalone PWA ───── */
.map-bottom-bar {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

/* ── Objective pill: lift above joystick on touch devices ── */
@media (pointer: coarse) {
  .explore-loc-bar {
    /* Joystick sits at bottom ~58px, 140px tall — clear it + 12px gap */
    bottom: calc(210px + env(safe-area-inset-bottom));
    padding: 6px 22px;
    min-width: 160px;
  }
  #explore-loc {
    font-size: var(--fs-sm);
    letter-spacing: 1px;
  }
}

/* ── Landscape phones: pill moves to top-center, ultra-compact ── */
@media (orientation: landscape) and (max-height: 500px) {
  .explore-loc-bar {
    bottom: auto;
    top: 44px; /* just below the explore-header bar */
    padding: 4px 16px;
    min-width: 0;
    max-width: 60vw;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
  #explore-loc {
    font-size: 10px;
    letter-spacing: 0.8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Zoom-reset button (hidden until JS zoomed state) */
.map-zoom-reset {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 20;
  font-family: var(--px);
  font-size: var(--fs-xxs);
  letter-spacing: 1px;
  padding: 5px 10px;
  background: rgba(5, 4, 22, 0.88);
  border: 1px solid rgba(96, 80, 184, 0.5);
  color: var(--ex-text);
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.2s;
}
.map-zoom-reset.visible { display: block; }
.map-zoom-reset:hover { background: rgba(96, 80, 184, 0.2); }

/* ── Landscape phones (≤ 900px) — XR/11 landscape ───── */
@media (max-width: 900px) {
  .map-region-panel { width: 300px; }
  .mrp-name      { font-size: 22px; }
  .mrp-lore      { font-size: 14px; }
  .mrp-actions   { padding: 12px 16px 18px; }
  .mrp-btn       { padding: 10px 12px; font-size: 11px; }
  .map-sel-btn   { min-width: 0; width: min(260px, 65vw); }
}

/* ── Tablet / medium screens (≤ 800px) ──────────────── */
@media (max-width: 800px) {
  .map-region-panel { width: 280px; }

  .explore-header   { padding: 6px 12px; }
  .explore-map-name { font-size: 16px; }
  .explore-map-hint { font-size: 13px; }
  .explore-menu-btn { font-size: 9px; padding: 4px 10px; }

  #explore-party-hud { display: flex; }
  #explore-minimap-wrap { right: 8px; }

  /* Map select overlay — slightly tighter on tablets */
  .map-sel-btn   { min-width: 0; width: min(260px, 70vw); padding: 12px 28px; }
  .map-node      { width: 40px; height: 40px; }
  .mn-marker     { width: 20px; height: 20px; }

  /* Region detail panel — compact for landscape phones (667–800px wide) */
  .map-region-panel { width: 240px; }
  .mrp-name      { font-size: 18px; padding: 0 14px; }
  .mrp-num       { padding: 12px 14px 0; }
  .mrp-loc       { padding: 0 14px; }
  .mrp-shard     { margin: 4px 14px; }
  .mrp-lore      { font-size: 13px; padding: 8px 14px; }
  .mrp-actions   { padding: 10px 14px 16px; gap: 6px; }
  .mrp-btn       { padding: 8px 10px; font-size: 10px; letter-spacing: 1px; }
}

/* ── Small mobile (≤ 600px) ─────────────────────────── */
@media (max-width: 600px) {
  .map-region-panel {
    top: auto;
    bottom: -100%;
    right: 0;
    left: 0;
    width: 100%;
    height: 70vh;
    border-right: none;
    border-top: 1px solid rgba(144, 128, 224, 0.4);
    border-radius: 20px 20px 0 0;
    transition: bottom 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  }
  .map-region-panel.open { bottom: 0; right: 0; }
  /* Allow native vertical scroll/swipe inside the panel */
  .map-region-panel { touch-action: pan-y; overscroll-behavior: contain; }

  #explore-party-hud { display: none !important; }
  #explore-minimap-wrap { right: 8px; left: auto; }

  .camp-panel { padding: 18px 20px 16px; gap: 10px; }
  .camp-btn   { padding: 10px 14px; font-size: 0.78rem; gap: 8px; }
  .camp-title { font-size: var(--fs-sm); letter-spacing: 3px; }

  .pause-panel  { padding: 14px 10px; gap: 10px; max-height: 95vh; overflow-y: auto; }
  .pause-title  { font-size: 11px; }
  .pause-party  { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pause-member { padding: 8px; }
  .pm-name      { font-size: 11px; }
  .pm-lv        { font-size: 9px; }
  .pause-btn    { font-size: 9px; padding: 8px 16px; }

  /* Map select overlay — smaller buttons on mobile */
  .map-sel-btn   { min-width: 0; width: min(260px, 80vw); padding: 11px 20px; font-size: 9px; letter-spacing: 1px; }
  .map-sel-crest { font-size: 1.6rem; margin-bottom: 8px; }
  .map-sel-title { font-size: 8px; letter-spacing: 2px; margin-bottom: 4px; }
  .map-sel-sub   { font-size: 13px; margin-bottom: 16px; }

  /* Region detail panel — tighter text */
  .mrp-name      { font-size: 20px; }
  .mrp-lore      { font-size: 14px; }
  .mrp-btn       { padding: 10px 14px; font-size: 9px; letter-spacing: 1px; }

  /* Landmark nodes — smaller on small screens */
  .map-node      { width: 36px; height: 36px; }
  .mn-marker     { width: 18px; height: 18px; }
  .mn-name       { font-size: 9px; }
}

/* ── Tiny phones (≤ 400px) ───────────────────────────── */
@media (max-width: 400px) {
  .camp-panel     { padding: 14px 14px 12px; width: min(300px, 94vw); }
  .camp-btn       { padding: 8px 12px; font-size: 0.72rem; gap: 6px; }
  .camp-btn-minor { padding: 6px 12px; }

  .map-sel-btn   { width: min(220px, 82vw); padding: 9px 16px; }
  .map-sel-crest { font-size: 1.3rem; }
  .mrp-name      { font-size: 17px; }
  .map-node      { width: 28px; height: 28px; }
  .mn-marker     { width: 14px; height: 14px; }
}

/* ── Wide desktop — hide party HUD (use pause menu instead) */
@media (max-width: 1280px) {
  .pause-party { grid-template-columns: 1fr; }
  #explore-party-hud { display: none !important; }
}
/* ── Camp Roster & Bond Visuals ──────────────────────── */
.camp-roster {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid rgba(144, 128, 224, 0.15);
}

.camp-char-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 64px;
}

.ccc-portrait {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.ccc-icon {
  font-size: 24px;
}

.ccc-name {
  font-family: var(--vt);
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.ccc-spark {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 20px;
  filter: drop-shadow(0 0 8px #f472b6);
  z-index: 5;
}

.pulse {
  animation: sparkPulse 2s infinite ease-in-out;
}

@keyframes sparkPulse {
  0%, 100% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 8px #f472b6); }
  50% { transform: scale(1.3); filter: brightness(1.5) drop-shadow(0 0 15px #f472b6); }
}
