:root {
  color-scheme: dark;
  --ink: #ece0c8;
  --muted: #ada18d;
  --dim: #837763;
  --gold: #d6ae68;
  --gold-bright: #f1d499;
  --line: #665037;
  --panel: #161710;
  --wood: #191610;
  --blue: #a8c8c6;
  font-family: "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; background: #0a0c0a; color: var(--ink); }
body { overflow: hidden; }
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, .map-viewport:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.map-app { display: flex; flex-direction: column; min-height: 100dvh; height: 100dvh; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); gap: 8px; background: radial-gradient(ellipse at 50% -30%, #302515 0, transparent 54%), #0a0c0a; }
.map-header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 22px; border: 1px solid var(--line); background: linear-gradient(110deg, #251d13, #111512 65%); }
.map-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.map-brand-mark { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-bright); font-size: 27px; box-shadow: 0 0 0 4px #2b2319; }
.map-brand div { display: grid; gap: 2px; min-width: 0; }
.map-brand div span, .map-kicker, .map-panel-heading > span { color: var(--gold); font: 700 10px/1.2 Consolas, monospace; letter-spacing: .16em; }
.map-brand strong { overflow: hidden; font: 700 21px/1 Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.map-layout { display: grid; grid-template-columns: minmax(190px, 230px) minmax(0, 1fr) minmax(220px, 260px); gap: 8px; min-height: 0; flex: 1; }
.map-ledger, .map-center, .map-details { min-height: 0; border: 1px solid var(--line); background: linear-gradient(155deg, #2b211533, transparent 34%), var(--panel); box-shadow: inset 0 0 0 1px #c8984530; }
.map-ledger, .map-details { display: flex; flex-direction: column; padding: 16px 12px; }
.map-panel-heading { flex: 0 0 auto; padding: 0 6px 12px; border-bottom: 1px solid #7c623b75; }
.map-panel-heading h2 { margin: 6px 0 0; font: 700 19px/1.15 Georgia, serif; }
.map-ledger-summary { padding: 13px 6px 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.map-search { display: grid; gap: 6px; padding: 12px 5px 0; }
.map-search label { color: var(--gold); font: 700 10px/1.2 Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.map-search-controls { display: flex; min-width: 0; }
.map-search input { width: 100%; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid #856a45; border-right: 0; border-radius: 0; color: var(--ink); background: #111410; font: 12px/1 'Segoe UI', Arial, sans-serif; }
.map-search input::placeholder { color: #a89c88; }
.map-search input::-webkit-search-cancel-button { cursor: pointer; }
.map-search button { flex: 0 0 auto; min-height: 34px; padding: 0 8px; border: 1px solid #856a45; color: var(--gold-bright); background: #342719; font: 700 10px/1 Consolas, monospace; }
.map-search button:hover { background: #52391f; }
.map-search p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.map-search p[hidden] { display: none; }
.map-village-list { min-height: 0; flex: 1; overflow: auto; padding: 0 3px 10px; scrollbar-color: #8f7145 #181915; }
.map-list-row { display: grid; width: 100%; grid-template-columns: 30px minmax(0,1fr); align-items: center; gap: 8px; margin-bottom: 4px; padding: 8px 6px; border: 1px solid transparent; background: transparent; color: var(--ink); text-align: left; }
.map-list-row:hover, .map-list-row.is-selected { border-color: #af8753; background: #4e392143; }
.map-list-row.is-distant { opacity: .75; }
.map-list-row img { width: 27px; height: 27px; }
.map-list-row strong { display: block; overflow: hidden; font: 700 12px/1.2 Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.map-list-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.map-older { flex: 0 0 auto; min-height: 39px; border: 1px solid #967449; color: var(--gold-bright); background: #4b35202b; font-size: 11px; }
.map-older:hover { background: #60402170; }
.map-older[hidden] { display: none; }
.map-center { display: flex; flex-direction: column; overflow: hidden; }
.map-toolbar { display: flex; min-height: 75px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 15px; border-bottom: 1px solid var(--line); background: #191812; }
.map-toolbar h1 { margin: 4px 0 0; font: 700 23px/1 Georgia, serif; }
.map-tools { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.map-tools button { width: 34px; height: 34px; border: 1px solid #806741; color: var(--gold-bright); background: #242015; font-size: 20px; }
.map-tools button:hover { background: #43311c; }
.map-tools .map-home { width: auto; padding: 0 10px; font: 700 11px/1 Consolas, monospace; }
.map-tools output { min-width: 42px; color: var(--muted); font: 700 11px/1 Consolas, monospace; text-align: center; }
.map-viewport { position: relative; min-height: 250px; flex: 1; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; background-color: #292b24; background-image: linear-gradient(#1418102b, #1418102b), url('/assets/map/terrain-v1.webp'); background-repeat: repeat; }
.map-viewport *, .map-viewport *::before, .map-viewport *::after { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.map-viewport ::selection { background: transparent; }
.map-viewport.is-dragging { cursor: grabbing; }
.map-viewport::before { position: absolute; inset: 0; z-index: 1; content: ""; pointer-events: none; box-shadow: inset 0 0 90px #11150fde; }
.map-viewport::after { position: absolute; inset: 8px; z-index: 2; content: ""; border: 1px solid #e6c99052; pointer-events: none; }
.map-stage { position: absolute; z-index: 0; top: 0; left: 0; transform-origin: 0 0; will-change: transform; background: linear-gradient(#1418102b, #1418102b), url('/assets/map/terrain-v1.webp') 0 0 / 960px 960px repeat; }
.map-pins { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.map-route { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.map-route path:first-child { fill: none; stroke: #1c1a13; stroke-width: 21; stroke-linecap: round; stroke-linejoin: round; opacity: .93; }
.map-route path:nth-child(2) { fill: none; stroke: #bb9f6d; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; opacity: .72; }
.map-pin { position: absolute; display: flex; width: 138px; height: 134px; flex-direction: column; align-items: center; justify-content: center; padding: 0; transform: translate(-50%, -50%); border: 0; color: #f1e1c2; background: none; text-align: center; pointer-events: none; }
.map-pin .map-pin-medallion { position: relative; display: grid; width: 62px; height: 62px; place-items: center; border: 2px solid #a7824d; border-radius: 50%; background: radial-gradient(circle at 45% 35%, #614d32, #211f19 76%); box-shadow: 0 0 0 5px #2b251ba8, 0 6px 14px #16150bc0; transition: transform .17s ease, border-color .17s ease, box-shadow .17s ease; pointer-events: none; }
.map-pin .map-pin-hit-area { position: absolute; top: 50%; left: 50%; z-index: 4; width: var(--map-pin-hit-size, 44px); height: var(--map-pin-hit-size, 44px); transform: translate(-50%, -50%); border-radius: 50%; cursor: pointer; pointer-events: auto; }
.map-viewport.is-dragging .map-pin .map-pin-hit-area { cursor: grabbing; }
.map-pin:hover .map-pin-medallion, .map-pin.is-selected .map-pin-medallion { transform: scale(1.12); border-color: #f1d499; box-shadow: 0 0 0 5px #b48a4c55, 0 0 22px #e6c07896; }
.map-pin.is-frontier .map-pin-medallion { border-color: #efce8b; }
.map-pin.is-distant { opacity: .8; }
.map-pin .map-pin-medallion > img { width: 42px; height: 42px; }
.map-pin .map-fish-badge { position: absolute; right: -12px; bottom: -5px; display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid #afd2cd; border-radius: 50%; background: #1d3432; }
.map-pin .map-fish-badge img { width: 21px; height: 21px; }
.map-pin .map-pin-name { display: block; max-width: 136px; margin-top: 9px; padding: 4px 7px; border: 1px solid #a88b59a6; background: #231e17ed; font: 700 13px/1.1 Georgia, serif; white-space: nowrap; }
.map-pin .map-pin-number { margin-top: 4px; color: #e0c28b; font: 700 10px/1 Consolas, monospace; }
.map-pin .map-pin-levels { margin-top: 3px; color: #d2c1a3; font: 10px/1 Consolas, monospace; }
.map-traveler { position: absolute; z-index: 2; display: grid; width: 37px; height: 37px; place-items: center; border: 1px solid #f1d499; border-radius: 50%; color: #f1d499; background: #29241a; box-shadow: 0 0 0 5px #c9a76655; font-size: 24px; pointer-events: none; }
.map-load-state { position: absolute; top: 50%; left: 50%; z-index: 4; width: min(90%, 330px); padding: 18px; transform: translate(-50%, -50%); border: 1px solid var(--line); background: #171813ee; color: var(--ink); text-align: center; line-height: 1.5; }
.map-load-state[hidden] { display: none; }
.map-compass { position: absolute; right: 23px; bottom: 20px; z-index: 3; display: grid; width: 48px; height: 70px; place-items: center; color: #ead9b6; font: 700 11px/1 Georgia, serif; pointer-events: none; opacity: .75; }
.map-compass i { width: 1px; height: 27px; background: #ebd7ad; }
.map-caption { display: flex; min-height: 35px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 13px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.map-detail-body { min-height: 0; overflow: auto; padding: 14px 5px; color: var(--ink); }
.map-detail-body p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-detail-icon { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid #9e814a66; }
.map-detail-icon img { width: 49px; height: 49px; padding: 5px; border: 1px solid var(--line); border-radius: 50%; background: #2a271b; }
.map-detail-icon strong { display: block; font: 700 13px/1.3 Georgia, serif; }
.map-detail-icon span { display: block; margin-top: 4px; color: var(--gold); font-size: 11px; }
.map-tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.map-tag { padding: 5px 7px; border: 1px solid #9f804e; color: #ebd4a6; background: #50391e55; font-size: 10px; }
.map-tag.is-fishing { border-color: #7ea9a3; color: #c0dfda; background: #24423f66; }
.map-buildings { margin: 14px 0 0; padding: 0; list-style: none; }
.map-buildings li { display: flex; justify-content: space-between; gap: 5px; padding: 9px 0; border-bottom: 1px solid #8e774544; font-size: 11px; }
.map-buildings li strong { color: var(--gold-bright); text-align: right; }
.map-detail-note { margin-top: 19px; padding: 10px; border-left: 2px solid #a48250; background: #4a3b2640; }
.map-travel-button { width: 100%; margin-top: 12px; padding: 11px 9px; border: 1px solid #d8b873; background: #584024; color: #fff0cb; font: 700 12px/1.3 Georgia, serif; cursor: pointer; }
.map-travel-button:hover:not(:disabled), .map-travel-button:focus-visible { background: #76552e; outline: 2px solid #e4c787; outline-offset: 2px; }
.map-travel-button:disabled { opacity: .6; cursor: wait; }
.map-travel-hint { margin-top: 13px; }
@media (max-width: 1050px) { .map-layout { grid-template-columns: minmax(155px, 195px) minmax(0,1fr) minmax(180px, 215px); } .map-ledger, .map-details { padding: 12px 8px; } }
@media (max-width: 760px) {
  body { overflow: auto; }
  .map-app { min-height: 100dvh; height: auto; padding: max(5px, env(safe-area-inset-top)) 5px max(8px, env(safe-area-inset-bottom)); }
  .map-header { min-height: 57px; padding: 6px 12px; }
  .map-brand-mark { width: 34px; height: 34px; font-size: 20px; }
  .map-brand div span { font-size: 8px; }
  .map-brand strong { font-size: 16px; }
  .map-navigation { display: none; }
  .map-layout { display: flex; flex-direction: column; gap: 6px; }
  .map-center { order: 0; min-height: min(60dvh, 530px); }
  .map-viewport { min-height: 290px; }
  .map-toolbar { min-height: 64px; padding: 6px 10px; }
  .map-toolbar h1 { font-size: 18px; }
  .map-kicker { font-size: 8px; }
  .map-tools button { width: 31px; height: 31px; }
  .map-tools .map-home { padding: 0 5px; font-size: 10px; }
  .map-caption { font-size: 9px; }
  .map-caption span:last-child { display: none; }
  .map-details { order: 1; min-height: 230px; }
  .map-detail-body { overflow: visible; }
  .map-ledger { order: 2; min-height: 210px; max-height: 310px; }
  .map-village-list { min-height: 100px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
