@font-face {
  font-family: 'Barlow Condensed';
  src: url('./assets/ui/BarlowCondensed-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #291d32;
  --soft: #66566a;
  --panel: #fff8ec;
  --line: #dacec2;
  --plum: #291b32;
  --berry: #963966;
  --coral: #fa926f;
  --mint: #96dbcb;
  --lav: #784180;
  --amber: #efbd68;
  --sunset: linear-gradient(108deg,#ffb774 0%,#ff8c89 39%,#e485bf 70%,#ab8ddf 100%);
  --shadow: 0 3px 0 #23182838,0 7px 25px #19162936;
  --heading: 'Barlow Condensed','Arial Narrow',sans-serif;
  --mono: Consolas,'Courier New',monospace;
  font: 14px/1.35 'Segoe UI',Arial,sans-serif;
  color: var(--ink);
  background: var(--plum);
}
* { box-sizing: border-box }
body { margin:0; height:100vh; height:100dvh; display:flex; flex-direction:column; overflow:hidden }
button,input,textarea,select { font:inherit }
button { display:inline-flex; align-items:center; justify-content:center; gap:7px; padding:0; border:0; color:inherit; background:transparent; cursor:pointer }
button:disabled { cursor:default }
a { color:var(--lav); text-underline-offset:3px }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,#map:focus-visible { outline:3px solid #8e3782; outline-offset:2px }
i { display:inline-flex; align-items:center; flex-shrink:0; font-style:normal }
svg { display:block }
h1,h2,h3,p,figure { margin:0 }
[hidden] { display:none!important }

header {
  display:flex; align-items:stretch; flex:none; height:64px; position:relative; z-index:5;
  color:var(--ink); background:var(--panel); box-shadow:0 2px 0 var(--plum),0 4px 10px #21172a33;
}
.brand {
  display:flex; align-items:center; gap:11px; flex:none; padding:0 40px 2px 22px;
  color:#fff7e9; background:var(--plum); clip-path:polygon(0 0,100% 0,calc(100% - 20px) 100%,0 100%);
  white-space:nowrap;
}
.brand img { width:44px; height:44px }
.brand small { display:block; font:700 10px/1.1 var(--heading); letter-spacing:2.1px; text-transform:uppercase; color:#f0c3bc }
.brand h1 { font:italic 700 32px/.94 var(--heading); text-transform:uppercase; letter-spacing:-.6px }
.brand em { font-style:inherit; color:#ffa395 }
nav { display:flex; align-items:stretch; gap:1px; margin:0 12px }
nav button { position:relative; min-width:90px; padding:0 14px; gap:7px; font:700 17px var(--heading); text-transform:uppercase; letter-spacing:.45px }
nav button:hover { background:#f3e6da }
nav button.active { color:#712d58; background:linear-gradient(0deg,#fbd6c88a,transparent 78%) }
nav button.active::after { content:''; position:absolute; inset:auto 10px 0; height:4px; transform:skewX(-18deg); background:var(--sunset) }
nav svg { width:17px; height:17px }
#spoiler { display:inline-flex; align-self:center; align-items:center; gap:6px; margin-left:auto; margin-right:20px; white-space:nowrap; font:700 14px var(--heading); letter-spacing:.5px; text-transform:uppercase; color:#514153 }
#spoiler svg { width:16px; height:16px; color:#70536b }

main { flex:1; min-height:0; overflow:hidden; position:relative; isolation:isolate }
#map,#cartography,#markers { position:absolute; inset:0; width:100%; height:100% }
#map { z-index:0; touch-action:none; overflow:hidden; cursor:grab; background:#1e4b74 }
#map.dragging { cursor:grabbing }
#map.placing { cursor:crosshair }
.ocean-frame { position:absolute; inset:0; pointer-events:none; box-shadow:inset 0 0 65px #1a214222; opacity:var(--frame-strength,1) }
#markers { pointer-events:none }
.marker {
  --color:#fac77e; position:absolute; pointer-events:auto; transform:translate(-50%,-50%); z-index:1;
  width:30px; height:30px; color:var(--color); border:2px solid currentColor; border-radius:50%; background:var(--plum);
}
.marker.game-marker { width:calc(var(--blip-size,20px) + 4px); height:calc(var(--blip-size,20px) + 4px); border:0; background:transparent; filter:drop-shadow(0 1px 2px #191624) }
.game-blip { display:block; flex:none; object-fit:contain }
.game-marker .game-blip { width:var(--blip-size,20px); height:var(--blip-size,20px) }
.marker:hover,.marker:focus-visible,.marker.selected { z-index:5; outline:2px solid #fff5e6; outline-offset:2px }
.marker.visited::after { content:'✓'; position:absolute; top:-5px; right:-5px; width:13px; height:13px; border-radius:50%; color:#16352e; background:var(--mint); font:bold 10px/13px sans-serif }
.marker .tip { display:none; position:absolute; bottom:calc(100% + 5px); left:50%; transform:translateX(-50%); white-space:nowrap; background:var(--plum); color:var(--panel); border-radius:3px; padding:4px 8px; font-size:12px }
.marker:hover .tip,.marker:focus-visible .tip { display:block }

.float,dialog { border:1px solid #453045; border-radius:4px; background:var(--panel); box-shadow:var(--shadow) }
#panel {
  position:absolute; top:17px; left:18px; width:290px; max-height:calc(100% - 72px);
  z-index:3; overflow:auto; scrollbar-width:thin; scrollbar-color:#bb9da8 var(--panel);
}
.collapsed #panel,#show-panel { display:none }
.collapsed #show-panel { display:flex; position:absolute; top:17px; left:18px; padding:0 14px; height:39px; font:700 16px var(--heading); text-transform:uppercase }
.panel-head {
  position:relative; display:flex; justify-content:space-between; align-items:center; padding:17px 16px;
  background:linear-gradient(106deg,#ffc485 4%,#ff9e96 50%,#e994c9 82%,#ae98db);
  overflow:hidden; isolation:isolate; border-bottom:1px solid #6a4459;
}
.panel-head::before { content:''; position:absolute; z-index:-1; right:-20px; bottom:-62px; width:167px; height:159px; background:url('./assets/ui/fronds.svg') center/contain no-repeat; transform:rotate(-20deg); opacity:.32 }
.panel-head h2,#detail h2,dialog h2 { font:italic 700 32px/.98 var(--heading); letter-spacing:-.4px; text-transform:uppercase }
.icon-btn { border-radius:3px; width:32px; height:32px }
.icon-btn:hover { background:#54304416 }
.panel-head .icon-btn { color:var(--ink); border:1px solid #51334765; background:#fff3e949 }
#explorer,#journal { padding:0 15px }
.searchbox { display:flex; align-items:center; gap:8px; height:38px; margin-top:12px; padding:0 9px; color:#735c72; background:#fffdfa; border:1px solid #bcacb4; border-radius:3px }
.searchbox:focus-within { border-color:var(--berry); box-shadow:0 0 0 1px var(--berry) }
.searchbox input { min-width:0; height:100%; width:100%; border:0; color:var(--ink); background:transparent; outline:none }
.searchbox input:focus-visible { outline:none }
input::placeholder,textarea::placeholder { color:#766776 }
.searchbox kbd { border:1px solid var(--line); padding:0 4px; color:var(--soft); font:11px var(--mono) }
.section-line { display:flex; justify-content:space-between; align-items:center; gap:4px; margin:15px 0 6px }
.section-line h3,.eyebrow,.kind-label { font:700 13px var(--heading); color:var(--soft); text-transform:uppercase; letter-spacing:1px }
.text-btn,.source,.more-results { color:var(--berry); font-weight:600; font-size:12px }
.text-btn:hover,.source:hover { text-decoration:underline }
.category { display:flex; width:100%; min-height:39px; justify-content:flex-start; gap:10px; border-bottom:1px solid var(--line); font-size:13px; font-weight:600; text-align:left }
.category:hover,.clothing-row:focus-within,.clothing-row:hover,.result:hover,.legend-row:hover { background:#f3e4d8 }
.tile { display:inline-flex; flex:none; align-items:center; justify-content:center; width:28px; height:28px; color:#57324f }
.category .num,.clothing-row small,.legend-row small { margin-left:auto; color:var(--soft); font:11px var(--mono) }
.tick { display:grid; place-items:center; width:16px; height:16px; border:1px solid #9a8795; border-radius:3px; color:white }
.category[aria-pressed=true] .tick { background:var(--berry); border-color:var(--berry) }
.category[aria-pressed=false] .tick svg { visibility:hidden }
.category[aria-pressed=false] .tile { opacity:.65 }
.clothing-row { display:flex; align-items:center; min-height:36px }
.clothing-row label { flex:1; min-width:0; min-height:36px; display:flex; align-items:center; gap:10px; cursor:pointer; font-size:13px }
.clothing-row input { width:16px; height:16px; margin:0; accent-color:var(--berry); cursor:pointer }
#clothing-filter>.clothing-row label { font-weight:650 }
#clothing-filter { border-bottom:1px solid var(--line) }
.clothing-toggle { width:34px; height:36px; color:var(--berry); font:24px/1 sans-serif }
.clothing-toggle[aria-expanded=true] { transform:rotate(90deg) }
.clothing-children { margin-left:8px; padding-left:10px; border-left:1px solid #d7c2c9 }
.kind-label { display:block; margin:13px 0 5px }
#kind-filter,dialog input,dialog textarea { width:100%; border:1px solid #bbaeb5; border-radius:3px; color:var(--ink); background:#fffdf8; padding:7px 8px }
#kind-filter { height:35px; font-size:13px }
.progress-block { margin-top:13px; border-top:1px solid var(--line) }
#progress-pct { font:700 14px var(--heading); color:var(--berry) }
.progress-track { height:4px; background:#e2d5ce }
#progress-fill { height:100%; background:linear-gradient(90deg,#c85489,#ac4e9e) }
.progress-caption { display:flex; align-items:center; gap:5px; margin-top:7px; font-size:12px; color:var(--soft) }
.progress-caption svg { width:13px; height:13px }
.panel-foot { padding:14px 15px }
.primary,.secondary { min-height:36px; padding:0 11px; font-weight:650; border-radius:3px }
.primary { background:var(--plum); color:#fff3e9; border-bottom:3px solid #ed8b9c }
.primary:hover { background:#513051 }
.panel-foot .primary { width:100% }
.secondary { border:1px solid #af99aa; color:var(--ink) }
.secondary[aria-pressed=true] { background:#d9ece1; color:#225340; border-color:#72927c }
#results,#group-list,#journal { overflow:auto; scrollbar-width:thin }
#results { max-height:210px; border-bottom:1px solid var(--line) }
#journal { max-height:50vh }
#group-list { max-height:52vh }
.result { display:flex; justify-content:flex-start; width:100%; padding:8px 2px; border-bottom:1px solid var(--line); text-align:left }
.result strong,.result small { display:block }
.result strong { font-size:13px }
.result small,.empty { font-size:12px; color:var(--soft) }
.empty,.journal-title { padding:12px 0 }
.more-results { padding:10px; width:100% }

.map-mode,.map-tools,#show-panel,.map-caption,.scale { z-index:1 }
.map-mode { position:absolute; right:18px; top:17px; display:flex; padding:3px; gap:1px; background:var(--plum) }
.map-mode button { height:31px; padding:0 10px; color:#f7ede2; font:700 15px var(--heading); text-transform:uppercase; letter-spacing:.4px; border-radius:2px }
.map-mode button[aria-pressed=true] { color:var(--ink); background:var(--sunset) }
.map-mode svg { width:15px; height:15px }
.compass { position:absolute; right:29px; top:67px; display:grid; justify-items:center; pointer-events:none; color:#fff5e5; text-shadow:0 1px 4px #17102b; filter:drop-shadow(0 1px 1px #161524) }
.compass b { font:700 14px var(--heading) }
.compass svg { width:24px; height:33px }
.map-tools { position:absolute; bottom:49px; right:18px; display:grid; gap:7px }
.zoom-tools { display:grid; overflow:hidden }
.map-tools button { width:39px; height:38px }
.zoom-tools button+button { border-top:1px solid var(--line) }
.map-tools button:hover { background:#ffe1c6 }
.map-caption { position:absolute; bottom:13px; left:18px; display:flex; align-items:center; gap:7px; padding:5px 10px; color:var(--panel); background:#2a1c33f2; border-left:3px solid #f59c9a; pointer-events:none; font:700 14px var(--heading); letter-spacing:.45px; text-transform:uppercase }
.map-caption svg { width:14px; height:14px; color:#ffc2a2 }
.scale { position:absolute; right:18px; bottom:12px; display:grid; justify-items:center; padding:3px 6px; color:white; background:#261d33d9; font:10px var(--mono); pointer-events:none }
#scale-bar { margin-top:2px; height:4px; border:1px solid #fff3ed; border-top:0 }
#relief-note,#placement { position:absolute; top:66px; right:17px; max-width:235px; padding:8px 10px; z-index:2; font-size:12px }
#placement { left:50%; right:auto; top:16px; transform:translateX(-50%); display:flex; align-items:center; gap:8px; max-width:calc(100% - 24px) }
.map-mode:has(#relief[aria-pressed=true])~.compass { top:125px }

#detail { position:absolute; left:50%; bottom:18px; transform:translateX(-50%); width:320px; max-width:calc(100% - 22px); max-height:calc(100% - 35px); overflow-y:auto; z-index:4; padding:14px 16px; border-top:4px solid #cc628e }
#detail .head,dialog .head { display:flex; align-items:center; justify-content:space-between; gap:10px }
.place-label { display:inline-flex; align-items:center; gap:6px; color:#74365d; font:700 13px var(--heading); letter-spacing:1px; text-transform:uppercase }
#detail h2 { margin:5px 0 3px; font-size:28px }
.region,.place-photo figcaption { color:var(--soft); font-size:12px }
#detail p,dialog p { margin:10px 0; font-size:14px; line-height:1.5; overflow-wrap:anywhere; white-space:pre-line }
.detail-actions { display:flex; align-items:center; gap:9px; flex-wrap:wrap; margin-top:12px }
.detail-actions .secondary { font-size:12px; padding:0 8px }
.place-photo { margin-top:10px }
.place-photo button { display:block; width:100%; position:relative; background:var(--plum); cursor:zoom-in }
.place-photo img { display:block; width:100%; height:clamp(94px,19vh,158px); object-fit:contain }
.photo-expand { position:absolute; right:4px; bottom:4px; background:#2e1e33e0; color:white; padding:0 4px; font-size:17px }
.place-photo figcaption { margin-top:4px; font-size:11px }
dialog { color:var(--ink); padding:18px; width:min(440px,calc(100vw - 24px)); max-height:84dvh; border-top:5px solid #d1769f }
dialog::backdrop { background:#241a36a3 }
dialog h2 { font-size:28px }
dialog h3 { margin-top:15px; font:700 20px var(--heading) }
dialog label { display:block; margin:12px 0 4px; font-weight:600 }
dialog textarea { min-height:74px; resize:vertical }
dialog .primary,.delete-pin { margin-top:12px }
.delete-pin { margin-left:10px }
.danger { color:#9b2949 }
#symbols { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:3px; margin-top:12px }
.legend-row { justify-content:flex-start; text-align:left; gap:7px; min-height:38px; padding:4px 7px; background:#f3e9dd; border-bottom:1px solid var(--line); font-size:12px }
.legend-row img { flex:none }
dialog:has(.photo-view) { width:min(880px,calc(100vw - 24px)); max-height:94dvh }
.photo-view { margin-top:12px }
.photo-view img { display:block; width:100%; max-height:68dvh; object-fit:contain; background:var(--plum) }
.photo-view a { display:inline-block; margin-top:8px; font-size:13px }
#status { position:absolute; z-index:8; bottom:47px; left:50%; transform:translateX(-50%); background:var(--plum); color:var(--panel); padding:8px 12px; border-left:3px solid var(--coral); font-size:13px; box-shadow:var(--shadow) }
#status:empty { display:none }
footer { flex:none; display:flex; align-items:center; gap:12px; height:25px; padding:0 18px; background:var(--plum); color:#f5dfdd; font:10px var(--mono) }
footer a { color:inherit; text-decoration:none }
footer a:hover { text-decoration:underline }
footer button { color:#f5dfdd; font:11px 'Segoe UI',sans-serif }
footer svg { width:13px; height:13px }
#coords { margin-left:auto }
@media(min-width:701px) and (max-width:980px) {
  .brand { padding-left:14px; padding-right:28px }
  nav { margin:0 4px }
  nav button { min-width:0; padding:0 10px }
  #spoiler { margin-right:10px }
  body:not(.collapsed) #detail { left:auto; right:74px; transform:none; width:min(300px,calc(100% - 405px)) }
}
@media(max-width:700px) {
  body { padding-bottom:calc(56px + env(safe-area-inset-bottom)) }
  header { height:51px }
  .brand { gap:7px; padding:0 28px 1px 11px }
  .brand img { width:35px; height:35px }
  .brand h1 { font-size:26px }
  .brand small { font-size:8px; letter-spacing:1.8px }
  #spoiler { margin-right:11px; font-size:12px }
  nav { display:grid; grid-template-columns:repeat(4,1fr); gap:0; position:fixed; inset:auto 0 0; margin:0; height:calc(56px + env(safe-area-inset-bottom)); padding-bottom:env(safe-area-inset-bottom); background:var(--panel); border-top:1px solid var(--plum) }
  nav button { min-width:0; min-height:44px; flex-direction:column; gap:2px; padding:4px 1px; font-size:12px }
  nav button.active::after { inset:0 12px auto; height:3px }
  nav svg { width:19px; height:19px }
  #panel { top:auto; left:8px; right:8px; bottom:7px; width:auto; max-height:calc(100% - 58px); box-shadow:0 -4px 22px #23182840 }
  .panel-head { padding:11px 15px }
  .panel-head h2 { font-size:27px }
  .collapsed #show-panel { display:none }
  .map-mode { top:10px; right:10px }
  .compass { top:58px; right:19px }
  .map-tools { right:10px; bottom:43px }
  .map-tools button { width:40px; height:42px }
  .scale { bottom:9px; right:10px }
  .map-caption { left:10px; bottom:9px; font-size:12px }
  #relief-note { top:54px; right:10px }
  #placement { top:56px; width:max-content }
  #detail { bottom:8px; left:8px; width:min(360px,calc(100% - 68px)); transform:none; max-height:calc(100% - 60px) }
  footer { height:21px; padding:0 10px; gap:8px; font-size:9px }
  footer button span,#coords { display:none }
  footer button { margin-left:auto }
  #status { bottom:calc(90px + env(safe-area-inset-bottom)); width:max-content; max-width:95vw }
  #symbols { gap:3px }
}
@media(max-height:490px) {
  #panel,#detail { max-height:calc(100% - 20px); bottom:8px; top:auto }
  #relief-note { max-width:180px }
}
