/* World map (item 71, src/world-map.js + src/minimap-dots.js, docs: file tools/docs/world-map.md).
   #minimap-dots lies over #minimap-scene inside .minimap (never changes its size or corners); the player dot, the camera
   box and the quest diamond come after it in the markup, so they stay on top. The window is a modal <dialog> in #game in
   the HUD's green/gold palette; the map pictures keep their aspect ratio inside a size container (fits 390 px and phone
   landscape), pins are positioned in %. No continuous animation. */
#minimap-dots{position:absolute;inset:0;width:100%;height:100%;border-radius:inherit;pointer-events:none}
.map-panel .minimap{cursor:pointer}

#game #world-map-dialog{box-sizing:border-box;width:min(1100px,calc(100vw - 24px));height:min(760px,calc(100dvh - 24px));max-width:none;max-height:none;margin:auto;padding:10px 12px;border:2px solid #c9a75b;border-radius:14px;background:linear-gradient(#24392c,#1b2c22);color:#fff8dc;font:13px Tahoma,"Noto Sans Thai",sans-serif;box-shadow:0 10px 28px #000b;overflow:hidden;display:none;flex-direction:column;gap:8px}
#game #world-map-dialog[open]{display:flex}
#game #world-map-dialog::backdrop{background:#0008}
#world-map-dialog .world-map-head{flex:none;display:flex;align-items:center;gap:8px;min-width:0}
#world-map-dialog .world-map-title{flex:1;min-width:0;margin:0;overflow:hidden;color:#f4dfa8;font-size:17px;letter-spacing:.4px;text-overflow:ellipsis;white-space:nowrap}
#world-map-dialog .world-map-tabs{flex:none;display:flex;gap:6px}
#world-map-dialog .world-map-tab{min-height:36px;padding:5px 14px;border:1px solid #8fcf8a66;border-radius:9px;background:#0003;color:#e9ffe2;font:bold 12px Tahoma,"Noto Sans Thai",sans-serif;cursor:pointer;white-space:nowrap}
#world-map-dialog .world-map-tab.active{border-color:#e2c172;background:#2f6b3a;color:#fff7d6}
#world-map-dialog .world-map-tab[hidden]{display:none}
#world-map-dialog .world-map-close{flex:none;width:38px;height:38px;min-height:0;padding:0;border:1px solid #c9a75b99;border-radius:50%;background:#0003;color:#fff8dc;font:bold 20px/1 Tahoma,sans-serif;cursor:pointer}
#world-map-dialog .world-map-close:hover,#world-map-dialog .world-map-close:focus-visible{background:#8a3a2b}
#world-map-dialog .world-map-message{flex:none;margin:0;color:#ffcfae;font-size:12px}
#world-map-dialog .world-map-message[hidden]{display:none}
#world-map-dialog .world-map-body{flex:1 1 auto;min-height:0;position:relative}
#world-map-dialog .world-map-view{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:0;container-type:size}
#world-map-dialog .world-map-view[hidden]{display:none}
#world-map-dialog .world-map-detail{justify-content:flex-start}
/* A map picture keeps the map's proportions: as large as the area allows (container units). */
#world-map-dialog .world-map-stage{--ratio:1.3333;position:relative;flex:none;width:min(100cqw,100cqh*var(--ratio));aspect-ratio:var(--ratio);border:2px solid #d8bd7a;border-radius:10px;background:#6c874b;overflow:hidden;box-shadow:0 3px 12px #0007}
#world-map-dialog .world-map-detail .world-map-stage{width:min(100cqw,(100cqh - 52px)*var(--ratio))}
#world-map-dialog .world-map-picture{display:block;width:100%;height:100%;filter:saturate(.85) brightness(.95)}
#world-map-dialog .world-map-paper{background:repeating-linear-gradient(0deg,#0000 0 31px,#7a5a2a14 31px 32px),repeating-linear-gradient(90deg,#0000 0 31px,#7a5a2a14 31px 32px),radial-gradient(circle at 50% 45%,#f4e6c2,#e0c890 70%,#c9a96a)}
#world-map-dialog .world-map-thumb{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
#world-map-dialog .world-map-thumb[hidden]{display:none}
#world-map-dialog .world-map-paper-name{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);max-width:80%;color:#5a3d16;font:bold 20px Tahoma,"Noto Sans Thai",sans-serif;text-align:center;opacity:.55}
#world-map-dialog .world-map-paper-name[hidden]{display:none}
#world-map-dialog .world-map-pins{position:absolute;inset:0;pointer-events:none}
/* Pins: a dot exactly at the spot and a small label beside it. */
#world-map-dialog .world-map-pin{position:absolute;display:flex;align-items:center;gap:3px;transform:translate(-7px,-50%);pointer-events:auto;white-space:nowrap}
#world-map-dialog .world-map-pin-flip{flex-direction:row-reverse;transform:translate(calc(-100% + 7px),-50%)}
#world-map-dialog .world-map-dot{flex:none;display:block;width:12px;height:12px;border-radius:50%;box-sizing:border-box;border:2px solid #1d2b22;background:#fff}
#world-map-dialog .world-map-label{max-width:150px;overflow:hidden;padding:1px 5px;border-radius:6px;background:#1b2c22cc;color:#fff8dc;font:bold 11px/1.35 Tahoma,"Noto Sans Thai",sans-serif;text-overflow:ellipsis;text-shadow:0 1px 1px #000}
#world-map-dialog .world-map-icon{flex:none;display:inline-flex;width:16px;height:16px;color:#f4dfa8}
#world-map-dialog .world-map-icon svg{width:16px;height:16px}
#world-map-dialog .world-map-pin-warp .world-map-dot{width:14px;height:14px;border-color:#e8fbff;background:radial-gradient(circle,#bff4ff 0 30%,#2bb7e8 31% 100%);box-shadow:0 0 0 2px #1b6a8a}
#world-map-dialog .world-map-pin-npc .world-map-dot{background:#fff2c8;border-color:#6b4423}
#world-map-dialog .world-map-npc-quest .world-map-dot{background:#ffd23f}
#world-map-dialog .world-map-mark{margin-left:1px;color:#ffd23f;font:900 14px/1 Tahoma,sans-serif;text-shadow:0 0 2px #3a2208,0 1px 1px #000}
#world-map-dialog .world-map-pin-friend .world-map-dot{background:#5fd35a;border-color:#123d14}
#world-map-dialog .world-map-pin-party .world-map-dot{background:#ffcf3d;border-color:#5a3c04}
#world-map-dialog .world-map-pin-target .world-map-dot{width:14px;height:14px;border-radius:2px;transform:rotate(45deg);background:#ffd23f;border-color:#7a4b00}
#world-map-dialog .world-map-pin-you{z-index:2}
#world-map-dialog .world-map-pin-you .world-map-label{background:#2f6b3acc}
#world-map-dialog .world-map-arrow{width:18px;height:18px;border:0;border-radius:0;background:none;position:relative;transform:rotate(var(--turn,180deg))}
#world-map-dialog .world-map-arrow::before{content:'';position:absolute;left:1px;top:0;border-left:8px solid #0000;border-right:8px solid #0000;border-bottom:18px solid #fffbe0;filter:drop-shadow(0 0 1px #000) drop-shadow(0 0 2px #2f6b3a)}
/* "โลก": paper background unless the admins uploaded a picture. */
#world-map-dialog .world-map-atlas{position:relative;flex:none;width:min(100cqw,100cqh*1.6);aspect-ratio:1.6;border:2px solid #d8bd7a;border-radius:10px;overflow:hidden;box-shadow:0 3px 12px #0007;
 background:repeating-linear-gradient(0deg,#0000 0 39px,#7a5a2a1a 39px 40px),repeating-linear-gradient(90deg,#0000 0 39px,#7a5a2a1a 39px 40px),radial-gradient(ellipse at 50% 45%,#f6e9c6,#e3cb93 65%,#bf9b5c);background-size:auto,auto,100% 100%}
#world-map-dialog .world-map-atlas.world-map-atlas-picture{background-size:cover;background-position:center;background-repeat:no-repeat}
#world-map-dialog .world-map-atlas.world-map-atlas-default{width:min(100cqw,75.96cqh);aspect-ratio:1093/1439;background-size:100% 100%}
#world-map-dialog .world-map-atlas-pins{position:absolute;inset:0}
#world-map-dialog .world-map-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);margin:0;color:#5a3d16;font-weight:bold}
#world-map-dialog .world-map-map{position:absolute;display:grid;justify-items:center;gap:2px;min-width:44px;min-height:40px;padding:4px 6px;border:0;background:none;color:#3b2a10;transform:translate(-50%,-30%);cursor:pointer;font:inherit}
#world-map-dialog .world-map-map-glyph{display:grid;place-items:center;width:30px;height:30px;border:2px solid #6b4423;border-radius:50%;background:#fff2c8;color:#6b4423;font:bold 17px/1 Tahoma,sans-serif;box-shadow:0 2px 4px #0006}
#world-map-dialog .world-map-map-current .world-map-map-glyph{border-color:#2f6b3a;background:#d9f7c9;box-shadow:0 0 0 3px #ffd23f}
#world-map-dialog .world-map-map-closed{opacity:.6}
#world-map-dialog .world-map-map-name{max-width:150px;overflow:hidden;padding:1px 6px;border-radius:6px;background:#fff6dcd9;color:#3b2a10;font:bold 12px/1.35 Tahoma,"Noto Sans Thai",sans-serif;text-overflow:ellipsis;white-space:nowrap}
#world-map-dialog .world-map-map:hover .world-map-map-name,#world-map-dialog .world-map-map:focus-visible .world-map-map-name{background:#2f6b3a;color:#fff7d6}
#world-map-dialog .world-map-map:focus-visible{outline:2px solid #ffd23f;outline-offset:2px;border-radius:8px}
#world-map-dialog .world-map-map-tags{display:flex;flex-wrap:wrap;justify-content:center;gap:2px;max-width:170px}
#world-map-dialog .world-map-tag{padding:0 5px;border-radius:5px;background:#1b2c22d9;color:#fff8dc;font:bold 10px/1.5 Tahoma,"Noto Sans Thai",sans-serif;white-space:nowrap}
#world-map-dialog .world-map-tag-here{background:#2f6b3a}
#world-map-dialog .world-map-tag-party{background:#8a6406}
#world-map-dialog .world-map-tag-friend{background:#1f6a24}
#world-map-dialog .world-map-tag-pvp{background:#8a2b1f}
#world-map-dialog .world-map-tag-closed{background:#5c5c5c}
#world-map-dialog .world-map-detail-head{flex:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0}
#world-map-dialog .world-map-back{flex:none;min-height:36px;padding:4px 12px;border:1px solid #e2c17299;border-radius:9px;background:#0003;color:#fff8dc;font:bold 12px Tahoma,"Noto Sans Thai",sans-serif;cursor:pointer}
#world-map-dialog .world-map-detail-name{min-width:0;overflow:hidden;color:#f4dfa8;font-size:15px;text-overflow:ellipsis;white-space:nowrap}
#world-map-dialog .world-map-detail-info{min-width:0;overflow:hidden;color:#cfe8c9;font-size:11px;text-overflow:ellipsis;white-space:nowrap}
/* Legend */
#world-map-dialog .world-map-legend{flex:none;display:flex;flex-wrap:wrap;justify-content:center;gap:4px 12px;color:#e9ffe2;font-size:11px}
#world-map-dialog .world-map-legend-item{display:inline-flex;align-items:center;gap:4px}
#world-map-dialog .world-map-legend-mark{display:inline-block;width:10px;height:10px;border-radius:50%;border:2px solid #1d2b22;background:#fff}
#world-map-dialog [data-legend="warp"] .world-map-legend-mark{background:#2bb7e8;border-color:#e8fbff}
#world-map-dialog [data-legend="shop"] .world-map-legend-mark{background:#fff2c8;border-color:#6b4423}
#world-map-dialog [data-legend="quest"] .world-map-legend-mark{background:#ffd23f;border-color:#6b4423}
#world-map-dialog [data-legend="you"] .world-map-legend-mark{width:12px;height:11px;border:0;border-radius:0;background:#fffbe0;clip-path:polygon(50% 0,100% 100%,0 100%)}
#world-map-dialog [data-legend="friend"] .world-map-legend-mark{background:#5fd35a;border-color:#123d14}
#world-map-dialog [data-legend="party"] .world-map-legend-mark{background:#ffcf3d;border-color:#5a3c04}
#world-map-dialog[data-tab="world"] .world-map-legend{display:none}
/* Touch: pins and map buttons are at least 32 px to tap. */
@media (pointer:coarse){
 #world-map-dialog .world-map-pin::after{content:'';position:absolute;left:-10px;top:50%;width:32px;height:32px;transform:translateY(-50%)}
 #world-map-dialog .world-map-map{min-width:48px;min-height:48px}
}
@media (max-width:600px){
 #game #world-map-dialog{padding:8px;gap:6px}
 #world-map-dialog .world-map-title{font-size:15px}
 #world-map-dialog .world-map-tab{padding:5px 10px}
 #world-map-dialog .world-map-label{max-width:96px;font-size:10px}
 #world-map-dialog .world-map-map-name{max-width:96px;font-size:11px}
 #world-map-dialog .world-map-legend{font-size:10px;gap:2px 8px}
}
/* Phone landscape: little height, so the legend goes and the header shrinks. */
@media (max-height:440px){
 #game #world-map-dialog{height:calc(100dvh - 12px);width:calc(100vw - 12px);padding:6px 10px}
 #world-map-dialog .world-map-legend{display:none}
 #world-map-dialog .world-map-close{width:34px;height:34px}
 #world-map-dialog .world-map-tab{min-height:32px}
}
