/* 地図は同源画像と SVG の座標だけで描画し、外部ライブラリに依存しない。 */
.world-map-page {
  max-width: 1600px;
  margin: auto;
  padding: 40px 28px 70px;
}
.world-map-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}
.world-map-heading h1 {
  font-size: clamp(28px, 4vw, 44px);
  margin: 12px 0;
}
.world-map-heading p {
  color: var(--muted);
  line-height: 1.8;
}
#world-map-status {
  font-size: 13px;
  color: var(--muted);
  margin: 20px 0;
}
.world-map-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.world-map-tabs button[aria-pressed="true"] {
  background: #d8b967;
  color: #26352d;
  border-color: #b99b50;
}
.world-map-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.world-map-sidebar {
  display: grid;
  gap: 16px;
}
.map-filter-box,
.map-info {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  min-width: 0;
}
.map-filter-box label {
  font-size: 13px;
  color: var(--muted);
}
.map-filter-box input:not([type="checkbox"]),
.map-filter-box select {
  width: 100%;
  min-width: 0;
  padding: 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  display: block;
  margin-top: 7px;
}
.map-filter-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  margin-top: 14px;
}
.world-map-page .hint,
.map-source-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.map-filter-box h2 {
  font-size: 16px;
  margin: 0;
}
.map-filter-box summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.map-filter-actions {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}
.map-kind-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 8px;
}
.map-layer-groups { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.map-layer-groups button { padding: 8px; min-height: 38px; font-size: 12px; }
.map-layer-groups button[aria-pressed="true"] { color: #231f15; background: #dbb66c; border-color: #bf943e; }
.map-kind-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; grid-column: 1 / -1; }
.map-kind-panel[hidden] { display: none; }
.map-info-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.map-info-actions button, .map-info-actions a { min-height: 40px; padding: 10px 14px; }
.map-pin.is-selected > circle { stroke: #fff0a6; stroke-width: 4px; paint-order: stroke; }
.map-kind-grid label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12px;
}
.map-kind-grid input {
  accent-color: #b49340;
  margin: 0;
  width: 16px;
  height: 16px;
}
.map-results {
  display: grid;
  gap: 6px;
  max-height: 450px;
  overflow-y: auto;
}
main .map-results .map-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 50px;
  padding: 10px;
  text-align: left;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--ink);
  border-radius: 6px;
}
.map-result strong {
  font-size: 13px;
}
.map-result span {
  color: var(--muted);
  font-size: 11px;
}
main .map-results .map-result:hover,
main .map-results .map-result[aria-pressed="true"] {
  border-color: var(--gold);
}
main .map-results .map-result.is-suitable {
  border-left: 4px solid #71a260;
}
.world-map-main {
  min-width: 0;
  background: var(--bg);
}
.map-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.map-canvas-toolbar h2 {
  font-size: 20px;
  margin: 0;
}
.map-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.map-toolbar-actions button {
  min-height: 40px;
}
.world-map-stage {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1b242a;
  position: relative;
  overflow: hidden;
}
#world-map-svg {
  width: 100%;
  height: clamp(560px, 80vh, 1080px);
  display: block;
  touch-action: none;
  cursor: grab;
}
#world-map-svg:active {
  cursor: grabbing;
}
#world-map-svg image {
  pointer-events: none;
}
.map-zone-label rect {
  fill: #142020dc;
  stroke: #d9bc72;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.map-zone-label text {
  fill: #fff3d2;
  font-weight: 700;
}
.map-zone-label.is-suitable rect {
  fill: #183c28;
  stroke: #a3df7e;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.map-zone-label,
.map-pin,
.map-meeting-pin {
  cursor: pointer;
}
.map-zone-label:hover rect,
.map-zone-label:focus rect {
  fill: #775c24;
}
.map-pin circle {
  fill: #caa951;
  stroke: #17231f;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.map-pin text {
  fill: #13211e;
  font-weight: 700;
  pointer-events: none;
}
.map-pin-flight circle {
  fill: #6ecde4;
}
.map-pin-instance circle,
.map-pin-quest circle {
  fill: #d3a8ef;
}
.map-pin-inn circle,
.map-pin-repair circle {
  fill: #a6d68f;
}
.map-pin:hover circle,
.map-pin:focus circle {
  stroke: white;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.map-meeting-pin circle {
  fill: #f0bc47;
  stroke: #fff4bf;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.map-meeting-pin text {
  fill: #201a0e;
  font-weight: 800;
}
.map-location-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.map-location-tools span {
  flex: 1;
  min-width: 170px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
#world-map-copy-fallback {
  width: 100%;
  padding: 10px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
}
.map-info h3 {
  font-size: 22px;
  margin: 10px 0;
}
.map-info p {
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.map-info .eyebrow {
  margin-top: 0;
}
#world-map-image-error {
  position: absolute;
  bottom: 0;
  padding: 16px;
  background: #201a10;
  color: #fff3cc;
}
.world-map-main:fullscreen {
  padding: 20px;
  overflow-y: auto;
}
.world-map-main:fullscreen #world-map-svg {
  height: 76vh;
}
@media (max-width: 1000px) {
  .world-map-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 14px;
  }
  .map-kind-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .world-map-page {
    padding: 28px 16px 60px;
  }
  .world-map-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .world-map-layout {
    display: flex;
    flex-direction: column;
  }
  .world-map-main {
    order: -1;
    width: 100%;
  }
  .world-map-sidebar {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }
  #world-map-svg {
    height: 480px;
  }
  .map-kind-grid {
    grid-template-columns: 1fr 1fr;
  }
  .map-results {
    max-height: 300px;
  }
  .world-map-tabs {
    gap: 8px;
  }
  .map-location-tools > button {
    flex: 1;
  }
}

.map-zone-dot {
  fill: #ecc466;
  stroke: #2c2414;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
#world-map-zone-picker {
  max-width: 230px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.map-city-browser {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 18px 0;
  background: var(--panel);
}
.map-city-browser summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--gold);
}
.map-city-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 16px;
  margin: 20px 0;
}
.map-city-controls label,
.map-layer-label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  min-width: 0;
}
.map-city-controls input,
.map-city-controls select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.map-city-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow: auto;
}
.map-city-results > p {
  grid-column: 1/-1;
}
.map-city-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: start;
  text-align: left;
  padding: 14px;
  overflow-wrap: anywhere;
}
.map-city-result span {
  font-size: 13px;
}
.map-city-result small {
  font-size: 11px;
}
.map-layer-label select {
  min-width: 130px;
}
@media (max-width: 800px) {
  .map-city-controls {
    grid-template-columns: 1fr 1fr;
  }
  .map-city-controls label:last-child {
    grid-column: 1/-1;
  }
  .map-city-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.map-view-tabs {
  display: flex;
  gap: 6px;
  padding: 7px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  margin: 0 0 12px;
}
.map-view-tabs button {
  margin: 0;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
}
.map-view-tabs :is(#map-terrain-tab, #map-game-tab)[aria-selected="true"] {
  background: #d8b764;
  color: #243127;
  border-color: #b7954c;
  box-shadow: inset 0 0 0 1px #b7954c;
}
#world-map-svg.map-overview .map-zone-label rect {
  fill: transparent;
  stroke: none;
}
#world-map-svg.map-overview .map-zone-dot {
  display: none;
}
#world-map-svg.map-overview .map-zone-label text {
  fill: #fff8e8;
  paint-order: stroke;
  stroke: #14201c;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}
#world-map-svg.map-overview .map-pin text {
  display: none;
}
#world-map-svg.map-overview .map-pin circle:not(.map-pin-hit) {
  fill: #056579cc;
  stroke: #63d3e6;
  stroke-width: 1.5px;
}
#world-map-svg.map-overview .map-pin-quest circle:not(.map-pin-hit) {
  fill: #1d6337cc;
  stroke: #69db75;
}
#world-map-svg .map-pin .map-pin-hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}
.map-layer-label[hidden] {
  display: none;
}

.map-stage-wrap {
  position: relative;
}
.map-stage-wrap > .map-view-tabs {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  margin: 0;
  background: var(--panel);
  box-shadow: 0 3px 14px #0003;
}
@media (max-width: 550px) {
  .map-stage-wrap > .map-view-tabs {
    top: 8px;
    left: 8px;
    padding: 5px;
  }
  .map-view-tabs button {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* 地図上に重ねる縮放ボタン（Wowhead と同様に地図の右上へ配置） */
.map-zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: grid;
  gap: 6px;
}
.map-zoom-controls button {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 3px 14px #0003;
  cursor: pointer;
}
.map-zoom-controls button:hover {
  border-color: var(--gold);
}
.map-drawer-toggle,
.map-drawer-head {
  display: none;
}

/* モバイル：地図を画面いっぱいに、検索・図層はボトムドロワーへ */
@media (max-width: 700px) {
  .world-map-page {
    padding-top: 18px;
  }
  .world-map-heading {
    gap: 8px;
  }
  .world-map-heading h1 {
    font-size: 24px;
    margin: 6px 0 0;
  }
  .world-map-heading p:not(.eyebrow),
  .world-map-heading > .action-link {
    display: none;
  }
  #world-map-status {
    margin: 8px 0;
  }
  #world-map-app {
    display: flex;
    flex-direction: column;
  }
  .map-city-browser {
    order: 2;
  }
  .world-map-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 8px 0 12px;
  }
  .world-map-tabs button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
  }
  .map-canvas-toolbar {
    gap: 8px;
    margin-bottom: 8px;
  }
  .map-canvas-toolbar h2 {
    font-size: 17px;
  }
  #world-map-zone-picker {
    flex: 1;
    max-width: none;
  }
  #world-map-svg {
    height: max(420px, calc(100svh - 190px));
  }
  .map-zoom-controls {
    top: 8px;
    right: 8px;
  }
  .map-drawer-toggle {
    position: absolute;
    bottom: 12px;
    left: 50%;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin: 0;
    padding: 0 18px;
    border: 1px solid #b89a4b;
    border-radius: 999px;
    background: #d8b967;
    color: #26352d;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 16px #0005;
    transform: translateX(-50%);
  }
  .map-drawer-toggle::before {
    content: "";
    width: 11px;
    height: 11px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-shadow: 5px 5px 0 -3.5px currentColor;
  }
  .world-map-sidebar {
    display: none;
  }
  .world-map-page.drawer-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 95;
    background: #0000008c;
  }
  .world-map-page.drawer-open .world-map-sidebar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 96;
    display: grid;
    gap: 12px;
    max-height: 80svh;
    padding: 0 14px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    background: var(--bg);
    box-shadow: 0 -10px 40px #00000040;
  }
  .world-map-page.drawer-open .map-drawer-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 6px;
    background: var(--bg);
    font-size: 17px;
  }
  .map-drawer-head button {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
  }
  .world-map-page.drawer-open .map-results {
    max-height: none;
  }
  .map-drawer-locked,
  .map-drawer-locked body {
    overflow: hidden;
  }
}

/* 交通航路：船は青、飛行艇は橙、天空船は紫の破線 */
.map-route {
  fill: none;
  stroke: #7fd3ff;
  stroke-linecap: round;
  pointer-events: none;
  opacity: 0.9;
}
.map-route-zeppelin {
  stroke: #f2a65a;
}
.map-route-skyship {
  stroke: #c9a2ff;
}
.map-route-label {
  cursor: pointer;
}
.map-route-label rect {
  fill: #10283a;
  stroke: #7fd3ff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.map-route-label.map-route-zeppelin rect {
  fill: #3a2410;
  stroke: #f2a65a;
}
.map-route-label.map-route-skyship rect {
  fill: #2a1a40;
  stroke: #c9a2ff;
}
.map-route-label text {
  fill: #f4fbff;
  font-weight: 700;
  pointer-events: none;
}
.map-route-label:hover rect,
.map-route-label:focus rect {
  stroke: #ffffff;
  stroke-width: 2.5;
}
.map-pin-boat circle {
  fill: #7fd3ff;
}
.map-pin-zeppelin circle {
  fill: #f2a65a;
}
.map-pin-skyship circle {
  fill: #c9a2ff;
}
#world-map-svg.map-overview .map-pin-boat circle:not(.map-pin-hit) {
  fill: #0d4a6ecc;
  stroke: #7fd3ff;
}
#world-map-svg.map-overview .map-pin-zeppelin circle:not(.map-pin-hit) {
  fill: #6e3d0dcc;
  stroke: #f2a65a;
}
#world-map-svg.map-overview .map-pin-skyship circle:not(.map-pin-hit) {
  fill: #4a2a6ecc;
  stroke: #c9a2ff;
}

/* 副本入口：地下城は円、団本は橙の菱形。拡大時は名前と推奨等級を表示 */
.map-pin-raid polygon {
  fill: #ef8a5b;
  stroke: #17231f;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.map-pin-raid:hover polygon,
.map-pin-raid:focus polygon {
  stroke: white;
  stroke-width: 3;
}
.map-pin.is-selected > polygon {
  stroke: #fff0a6;
  stroke-width: 4px;
  paint-order: stroke;
}
#world-map-svg.map-overview .map-pin-raid polygon {
  fill: #8a3a1ccc;
  stroke: #ffab7f;
  stroke-width: 1.5px;
}
#world-map-svg .map-pin .map-instance-label {
  fill: #fff3d2;
  font-weight: 700;
  paint-order: stroke;
  stroke: #14201c;
  stroke-width: 3px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
#world-map-svg .map-pin-raid .map-instance-label {
  fill: #ffd2bb;
}

/* 区域・地点カード：選択時だけ地図の上に重ねて表示 */
.world-map-page #world-map-info {
  display: none;
}
.world-map-page.info-open #world-map-info {
  position: absolute;
  top: 12px;
  right: 68px;
  z-index: 5;
  display: block;
  width: min(360px, calc(100% - 92px));
  max-height: calc(100% - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 10px 30px #0000004d;
}
.map-info-close {
  float: right;
  width: 36px;
  height: 36px;
  margin: -4px -4px 0 8px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.map-info h4 {
  margin: 16px 0 8px;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--gold);
}
.map-fit {
  display: inline-block;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px !important;
  font-weight: 700;
}
.map-fit-fit {
  background: #2f6b3b33;
  color: #4f9a4a;
}
.map-fit-high {
  background: #9a3f2f26;
  color: #c0533f;
}
.map-fit-low {
  background: #7a7a7a26;
  color: var(--muted);
}
.map-zone-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  margin: 14px 0 4px;
}
.map-zone-stats span {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
}
.map-zone-stats strong {
  font-size: 18px;
  color: var(--gold);
}
.map-zone-stats small {
  font-size: 11px;
  color: var(--muted);
}
.map-zone-list {
  display: grid;
  gap: 6px;
}
main .map-zone-list .map-zone-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  text-align: left;
}
main .map-zone-list .map-zone-item:hover {
  border-color: var(--gold);
}
.map-zone-item strong {
  font-size: 13px;
}
.map-zone-item small {
  font-size: 11px;
  color: var(--muted);
}
@media (max-width: 1000px) {
  .world-map-page.info-open #world-map-info {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    width: auto;
    max-height: 48svh;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 34px #00000045;
  }
  .world-map-page.info-open #world-map-info::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin: -6px auto 10px;
    border-radius: 2px;
    background: var(--line);
  }
}
.map-info-expand {
  display: none;
}
@media (max-width: 1000px) {
  main .map-info .map-info-expand {
    display: inline-flex;
    min-height: 36px;
    margin: 0 0 4px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
  }
  .world-map-page.info-open:not(.info-expanded) #world-map-info {
    max-height: 150px;
    overflow: hidden;
  }
}
