/* The world map (src/map.js): the whole window on /map/, a small frame on item and town pages. */
#kmap { display: grid; grid-template-columns: 1fr 330px; height: calc(100vh - 210px); min-height: 460px; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #5b5741; }
.km-mini #kmap { display: block; height: 380px; min-height: 0; }
.km-stage { position: relative; height: 100%; min-width: 0; touch-action: none; }
#kmap canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
/* the panel on the right: what was clicked, where an item is, the towns */
.km-side { overflow-y: auto; padding: 14px 16px; background: var(--panel); color: var(--ink); border-left: 1px solid var(--line-2); font-size: 14px; }
.km-side h3 { margin: 2px 0 8px; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.km-side h3 img { border-radius: 4px; background: radial-gradient(circle at 50% 40%, #3a3127, #17130f); }
.km-kind { margin: 0; color: var(--muted); font-size: 12px; }
.km-sub { color: var(--muted); margin: 12px 0 4px; font-size: 13px; }
.km-list, .km-items { list-style: none; margin: 0; padding: 0; }
.km-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.km-list button { flex: 1; text-align: left; background: none; border: 0; padding: 6px 0; color: var(--game-ac-ink, #e08a6c); font: inherit; cursor: pointer; }
.km-list button:hover { text-decoration: underline; }
.km-list small, .km-list a { color: var(--muted); font-size: 12px; white-space: nowrap; }
.km-items li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.km-items img, .km-noimg { width: 24px; height: 24px; flex: none; border-radius: 3px; background: radial-gradient(circle at 50% 40%, #3a3127, #17130f); }
.km-items small { color: var(--muted); margin-left: auto; }
.km-back, .km-other { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-2); border-radius: 5px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; margin-bottom: 8px; }
#kmap canvas:active { cursor: grabbing; }
.km-bar { position: absolute; left: 8px; top: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; z-index: 2; pointer-events: none; }
.km-bar > * { pointer-events: auto; }
.km-bar button, .km-open, .km-zoom button { font: 600 13px/1 var(--sans, sans-serif); padding: 8px 11px; border-radius: 6px; border: 1px solid rgba(40, 28, 16, .55); background: rgba(246, 238, 220, .94); color: #2a1d12; cursor: pointer; text-decoration: none; }
.km-bar button[aria-pressed="true"] { background: #8f2f1e; color: #fff4e6; border-color: #5e1d12; }
.km-find { flex: 1 1 220px; max-width: 360px; padding: 8px 10px; border-radius: 6px; border: 1px solid rgba(40, 28, 16, .55); background: rgba(255, 251, 242, .97); color: #2a1d12; font: 14px var(--sans, sans-serif); }
.km-layers { display: flex; gap: 6px; flex-wrap: wrap; }
.km-layers label { font: 600 13px var(--sans, sans-serif); padding: 6px 9px; border-radius: 6px; background: rgba(246, 238, 220, .94); color: #2a1d12; border: 1px solid rgba(40, 28, 16, .55); cursor: pointer; }
.km-open { margin-left: auto; }
.km-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.km-zoom button { width: 36px; height: 36px; padding: 0; font-size: 20px; }
.km-tip { position: absolute; z-index: 3; width: 250px; padding: 10px 12px; border-radius: 8px; background: rgba(250, 244, 230, .98); color: #2a1d12; border: 1px solid #8b7148; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); font: 13px/1.4 var(--sans, sans-serif); }
.km-tip ul { list-style: none; margin: 6px 0 0; padding: 0; }
.km-tip li { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.km-tip li img { border-radius: 3px; background: #2b231a; }
.km-tip small { color: #6d5a43; }
#kmap.failed::after { content: 'The map did not load. Reload the page to try again.'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
@media (max-width: 900px) {
  #kmap { grid-template-columns: 1fr; grid-template-rows: minmax(360px, 62vh) auto; height: auto; }
  .km-side { border-left: 0; border-top: 1px solid var(--line-2); max-height: 60vh; }
}
@media (max-width: 640px) { .km-mini #kmap { height: 300px; } .km-layers label { padding: 5px 7px; } }
