/* 地図は同源画像と 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;
  }
}
