/* World map (systems/map/): top bar, the map view with HTML markers, the list view and the card.
   Marker colors: gold ring = already in your Pokédex, purple = you are here, gray = level too low. */

/* min-width 0: a zoomed-in map must not stretch the panel (it pans inside its box instead) */
.mp { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; background: #0b1a2e; }

/* ---------------------------------------------------------------- top bar */
.mp-bar { display: grid; gap: 8px; padding: 10px 12px; background: #0d1729; border-bottom: 1px solid var(--line); }

/* every tab visible, in even columns that wrap to a new row (never a sideways scroll) */
.mp-regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.mp-region {
  display: grid; gap: 1px; text-align: left; min-width: 0;
  padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line); background: #0b1424;
  color: var(--muted); font-family: var(--pixel);
}
.mp-region:hover { color: var(--text); background: #14223b; }
.mp-region.on { background: var(--card-2); border-color: var(--accent); color: var(--accent); }
.mp-region.done .mp-region-name { color: var(--accent); }
.mp-region.locked:not(.on) { opacity: 0.6; }
.mp-region-name { font-size: 0.9rem; }
.mp-region-sub { font-family: 'Inter', sans-serif; font-size: 0.68rem; color: var(--muted); }

.mp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Mapa | Lista: a sliding knob under the chosen half */
.mp-mode { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 10px; background: #0b1424; border: 1px solid var(--line); }
.mp-mode-knob {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 7px;
  background: #5b3fa8; transform: translateX(calc(var(--pos, 0) * 100%)); transition: transform 0.2s ease;
}
.mp-mode-bt { position: relative; padding: 5px 14px; font-family: var(--pixel); font-size: 0.85rem; color: var(--muted); }
.mp-mode-bt.on { color: #fff; }

.mp-search {
  width: 230px; padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #0b1424; color: var(--text); font: inherit; font-size: 0.85rem;
}
.mp-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* filter menus */
.mp-drop { position: relative; }
.mp-drop > summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 6px;
  padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0b1424; font-size: 0.8rem;
}
.mp-drop > summary::-webkit-details-marker { display: none; }
.mp-drop > summary::after { content: '▾'; color: var(--muted); font-size: 0.7rem; }
.mp-drop[open] > summary { border-color: var(--accent); }
.mp-drop-label { color: var(--muted); }
.mp-drop-value { color: var(--text); font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-drop-body {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 240px;
  display: grid; gap: 8px; padding: 10px; border-radius: 12px;
  background: #0d1729f8; border: 1px solid var(--line); box-shadow: 0 12px 30px #000a;
}
.mp-drop-hint { color: var(--muted); font-size: 0.75rem; }
.mp-type-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 5px; }
.mp-type { padding: 2px; border-radius: 7px; border: 2px solid transparent; opacity: 0.55; }
.mp-type:hover { opacity: 0.85; }
.mp-type.on { opacity: 1; border-color: var(--accent); }
.mp-options { display: grid; gap: 4px; }
.mp-option { text-align: left; padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; color: var(--muted); }
.mp-option:hover { background: var(--card); color: var(--text); }
.mp-option.on { background: var(--card-2); color: var(--accent); }
.mp-level { display: flex; gap: 8px; }
.mp-level label { display: grid; gap: 2px; font-size: 0.72rem; color: var(--muted); }
.mp-num { width: 90px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: #0b1424; color: var(--text); font: inherit; }
.mp-check { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; cursor: pointer; }
.mp-clear { padding: 6px 12px; border-radius: 10px; font-size: 0.8rem; color: #ff9aa9; border: 1px solid #6b2b40; background: #3a1c2a; }
.mp-clear[hidden] { display: none; }

/* ---------------------------------------------------------------- body */
.mp-body { position: relative; flex: 1; min-height: 0; display: flex; }
.mp-error { padding: 24px; }

/* the map view */
.mp-world-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.mp-world-wrap[hidden] { display: none; }
/* no scrollbars: the map moves by dragging (scrollLeft/Top still work on a hidden overflow) */
.mp-world { position: relative; flex: 1; display: flex; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.mp-world:focus { outline: none; }
.mp-world.dragging { cursor: grabbing; }
.mp-world[hidden] { display: none; }
/* centered while the whole region fits in the box; scrolls normally once zoomed past it */
.mp-stage { position: relative; --z: 1; flex: none; margin: auto; }
.mp-img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.mp-markers { position: absolute; inset: 0; }

.mk {
  position: absolute; left: calc(var(--x) * var(--z) * 1px); top: calc(var(--y) * var(--z) * 1px);
  transform: translate(-50%, -50%); display: grid; justify-items: center; z-index: 1;
}
.mk[hidden] { display: none; }
.mk-disc {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #1d3157, #0b1424 75%);
  border: 2px solid #e94560; box-shadow: 0 2px 6px #000a; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.mk-lv {
  margin-top: -7px; min-width: 22px; padding: 0 5px; border-radius: 5px; text-align: center;
  background: #e94560; color: #fff; font-family: var(--pixel); font-size: 0.66rem; line-height: 13px;
}
.mk:hover, .mk:focus-visible { z-index: 3; }
.mk:hover .mk-disc, .mk:focus-visible .mk-disc { transform: scale(1.18); box-shadow: 0 0 0 3px #ff9ad566, 0 4px 10px #000c; border-color: #ff9ad5; }
.mk.town .mk-disc { border-color: #7fb2ff; background: radial-gradient(circle at 50% 40%, #24477e, #0f1d38 75%); }
.mk.town .mk-lv { background: #3b6fd1; }
.mk.caught .mk-disc { border-color: var(--accent); box-shadow: 0 0 0 2px #ffd23f44, 0 2px 6px #000a; }
.mk.caught .mk-lv { background: #b8901a; }
.mk.locked .mk-disc { border-color: #59647a; }
.mk.locked .sprite-box { filter: grayscale(1) brightness(1.1); opacity: 0.7; }
.mk.locked .mk-lv { background: #4a5468; }
.mk.locked .mk-lv::before { content: '🔒'; font-size: 0.55rem; margin-right: 2px; }
.mk.here { z-index: 2; }
.mk.here .mk-disc { border-color: #b26bff; box-shadow: 0 0 0 4px #b26bff55, 0 0 14px #b26bffaa; animation: mk-here 1.8s ease-in-out infinite; }
.mk.sel .mk-disc { transform: scale(1.2); border-width: 3px; }
@keyframes mk-here { 50% { box-shadow: 0 0 0 7px #b26bff33, 0 0 18px #b26bffcc; } }
@media (prefers-reduced-motion: reduce) { .mk.here .mk-disc { animation: none; } }

.mp-zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.mp-hint {
  position: absolute; left: 12px; bottom: 12px; padding: 4px 10px; border-radius: 8px; pointer-events: none;
  background: #0b1424cc; color: var(--muted); font-size: 0.72rem;
}
@media (max-width: 600px) { .mp-hint { display: none; } }
.mp-world-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.mp-world-empty[hidden] { display: none; }

/* ---------------------------------------------------------------- list view */
.ml { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml[hidden] { display: none; }
.ml-head, .ml-row { display: grid; grid-template-columns: 48px minmax(140px, 1.6fr) 80px minmax(120px, 1fr) 28px 130px; align-items: center; gap: 10px; }
.ml-head { padding: 6px 14px; border-bottom: 1px solid var(--line); background: #0d1729; }
.ml-col { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.ml-col-name { grid-column: 2; }
.ml-col-level { grid-column: 3; }
.ml-col-type { grid-column: 4; }
.ml-col.on { color: var(--accent); }
.ml-arrow { font-size: 0.6rem; opacity: 0; transition: transform 0.2s; }
.ml-col.on .ml-arrow { opacity: 1; }
.ml-col.desc .ml-arrow { transform: rotate(180deg); }
.ml-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.ml-body { display: grid; }
.ml-row { padding: 5px 14px; border-bottom: 1px solid #ffffff0a; cursor: pointer; }
.ml-row:hover, .ml-row:focus-visible { background: #16264399; outline: none; }
.ml-row.sel { background: #1f3460; }
.ml-disc { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 40%, #1d3157, #0b1424 75%); border: 2px solid #e94560; }
.ml-row.town .ml-disc { border-color: #7fb2ff; }
.ml-row.caught .ml-disc { border-color: var(--accent); }
.ml-row.here .ml-disc { border-color: #b26bff; box-shadow: 0 0 10px #b26bffaa; }
.ml-row.locked { opacity: 0.7; }
.ml-row.locked .ml-disc { border-color: #59647a; }
.ml-row.locked .sprite-box { filter: grayscale(1) brightness(1.1); }
.ml-name { display: grid; }
.ml-name b { font-weight: 600; }
.ml-name small { color: var(--muted); font-size: 0.72rem; }
.ml-level { font-family: var(--pixel); color: var(--muted); }
.ml-types { display: flex; gap: 4px; flex-wrap: wrap; }
.ml-caught { color: var(--accent); font-weight: 700; visibility: hidden; }
.ml-row.caught .ml-caught { visibility: visible; }
.ml-go { justify-self: end; }
.ml-lock { font-size: 0.75rem; color: #8b95a8; }
.ml-here { font-size: 0.75rem; color: #c9a2ff; font-family: var(--pixel); }
.ml-empty { display: grid; justify-items: center; gap: 10px; padding: 40px 16px; color: var(--muted); text-align: center; }
.ml-empty[hidden] { display: none; }

/* ---------------------------------------------------------------- card */
.mp-card {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10;
  display: flex; flex-direction: column; gap: 8px;
  background: #0d1729f2; border: 2px solid var(--line); border-radius: 14px;
  padding: 10px 14px 10px 10px; width: min(560px, calc(100% - 24px));
  box-shadow: 0 10px 30px #000a;
}
.mp-card[hidden] { display: none; }
/* in the list the card docks on the right instead of covering rows */
.mp.is-list .mp-card { position: static; transform: none; width: 340px; flex: none; margin: 12px; align-self: flex-start; }
.mp-card-close { position: absolute; top: 4px; right: 8px; color: var(--muted); font-size: 0.9rem; }
.mp-card-close:hover { color: var(--text); }
.mp-card-main { display: flex; align-items: center; gap: 14px; padding-right: 18px; }
.mp.is-list .mp-card-main { flex-wrap: wrap; }
.mp-card-portrait {
  width: 64px; height: 64px; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle, #2a4a7a, #13213b); border-radius: 12px; border: 2px solid transparent;
}
.mp-card-portrait.caught { border-color: var(--accent); }
.mp-card-portrait img { width: 56px; height: 56px; object-fit: contain; }
.mp-card-info { flex: 1; min-width: 0; }
.mp-card-name { font-family: var(--pixel); font-size: 1.25rem; }
.mp-card-caught { color: var(--accent); }
.mp-card-sub { color: var(--muted); font-size: 0.85rem; }
.mp-card-details { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid #ffffff12; }
.mp-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.82rem; }
.mp-card-row .gold { color: var(--accent); font-family: var(--pixel); }
.mp-card-drops { display: flex; flex-wrap: wrap; gap: 4px; }
.drop-chip { background: #0b1424; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--text); }
.drop-chip b { color: var(--accent); font-weight: 600; }
/* the chip's border and name take the item's rarity color (rarity.css) */
.drop-chip[class*='rar-'] { border-color: color-mix(in srgb, var(--rar) 60%, transparent); color: var(--rar); background: linear-gradient(90deg, var(--rar-glow), #0b1424); }

@media (max-width: 760px) {
  .mp-search { flex: 1; width: auto; min-width: 140px; }
  .ml-head, .ml-row { grid-template-columns: 44px 1fr 56px 96px; }
  .ml-types, .ml-col-type, .ml-caught { display: none; }
  .mp-body { flex-direction: column; }
  .mp.is-list .mp-card { width: auto; margin: 0 12px 12px; order: -1; align-self: stretch; }
}

/* Hunt Analyser (../huntanalyser.js): the selected hunt's per-hour numbers, from the server */
.mp-analyser {
  position: absolute; top: 12px; right: 64px; z-index: 11; width: 300px; max-height: calc(100% - 24px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding: 12px;
  background: #0d1729f2; border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px #000a;
  scrollbar-width: thin; scrollbar-color: #34507f transparent;
}
.mp-analyser[hidden] { display: none; }
.mp.is-list .mp-analyser { position: static; width: 320px; flex: none; margin: 12px 12px 12px 0; align-self: flex-start; max-height: none; }
/* card and Analyser both open by the list: one column on the right, one over the other, so the
   rows keep their full width (two side columns cut the action buttons on a 1366 screen) */
@media (min-width: 761px) {
  html:not(.mobile) .mp.is-list .mp-body:has(> .mp-card:not([hidden])):has(> .mp-analyser:not([hidden])) {
    display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); align-items: start;
  }
  html:not(.mobile) .mp.is-list .mp-body:has(> .mp-card:not([hidden])):has(> .mp-analyser:not([hidden])) > .ml { grid-column: 1; grid-row: 1 / span 2; align-self: stretch; min-height: 0; }
  html:not(.mobile) .mp.is-list .mp-body:has(> .mp-card:not([hidden])):has(> .mp-analyser:not([hidden])) > .mp-card { grid-column: 2; grid-row: 1; width: auto; margin: 12px 12px 0 0; }
  html:not(.mobile) .mp.is-list .mp-body:has(> .mp-card:not([hidden])):has(> .mp-analyser:not([hidden])) > .mp-analyser { grid-column: 2; grid-row: 2; width: auto; margin: 12px 12px 12px 0; max-height: calc(100% - 24px); overflow-y: auto; }
}
.an-title { font-family: var(--pixel); font-size: 1.05rem; color: var(--accent); }
.an-with { margin-bottom: 2px; }
.an-warn { margin-top: 4px; padding: 6px 8px; border-radius: 8px; background: #4a1d24; color: #ffb3b3; font-size: 0.78rem; }
@media (max-width: 720px) {
  .mp-analyser { top: auto; bottom: 150px; right: 8px; left: 8px; width: auto; max-height: 38%; }
}
