/* Layout: full-bleed 3D diorama; souvenir-map chrome floats at the edges. */
:root {
  --maroon: #7b1e3a;
  --maroon-deep: #4a1123;
  --jacaranda: #8b6cc7;
  --gold: #f0a92e;
  --mud: #8a6d47;
  --gum: #3f7a4a;
  --paper: #fffaf7;
  --ink: #2b1a20;
  --muted: #6d5a60;
  --line: rgba(123, 30, 58, 0.16);
  --display: 'Shrikhand', Georgia, serif;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #dfe9ea; color: var(--ink); font: 15px/1.45 var(--body); overflow: hidden; }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#brand, #status, #side, #card, #dock, #panel { z-index: 2; }
#dock .osm { color: rgba(255,255,255,.6); font-size: 11px; padding: 0 10px 0 4px; white-space: nowrap; text-decoration: none; }
#dock .osm:hover { color: #fff; }

/* ---- floating chrome ---- */
#brand { background: rgba(255, 250, 247, .82); border-radius: 14px; padding: 8px 14px 10px; position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); pointer-events: none; }
#brand h1 { font: 400 clamp(26px, 3.4vw, 40px)/1 var(--display); color: var(--maroon); margin: 0; text-shadow: 0 2px 0 #fff, 0 3px 12px rgba(255,255,255,.6); letter-spacing: 0.01em; }
#brand p { margin: 4px 0 0; font-size: 13px; color: var(--maroon-deep); text-shadow: 0 1px 4px #fff; max-width: 34ch; }

#status { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); background: var(--paper); border-radius: 14px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(74, 17, 35, .18); max-width: 260px; display: grid; gap: 3px; }
#status .clock { font-variant-numeric: tabular-nums; }
#status .clock strong { font: 400 22px/1 var(--display); color: var(--maroon); }
#status .clock span { font-size: 12px; color: var(--muted); }
.note { font-size: 12.5px; color: var(--muted); }
.pill { justify-self: start; background: #111; color: #fff; font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; margin-top: 4px; }
.pill::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; margin-right: 6px; box-shadow: inset 0 0 0 2px #111; }

#side { position: absolute; left: max(16px, env(safe-area-inset-left)); top: 110px; bottom: 86px; width: 290px; background: var(--paper); border-radius: 16px; box-shadow: 0 8px 30px rgba(74, 17, 35, .18); display: flex; flex-direction: column; overflow: hidden; }
.search input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; background: transparent; outline: none; }
.search input:focus-visible { box-shadow: inset 0 -2px 0 var(--maroon); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chip { border: 1.5px solid var(--c); color: var(--c); background: transparent; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--c); color: #fff; }
#list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
#list li button { width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; cursor: pointer; display: grid; grid-template-columns: 10px 1fr; gap: 2px 10px; align-items: baseline; }
#list li button:hover, #list li button:focus-visible { background: rgba(123, 30, 58, .07); outline: none; }
#list .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); align-self: center; }
#list .nm { font-weight: 700; }
#list .sub { grid-column: 2; font-size: 12.5px; color: var(--muted); }
#list .empty { padding: 16px; color: var(--muted); }

/* ---- the place card ---- */
#card { position: absolute; right: max(16px, env(safe-area-inset-right)); top: 150px; bottom: 86px; width: 360px; background: var(--paper); border-radius: 18px; box-shadow: 0 12px 40px rgba(74, 17, 35, .25); overflow-y: auto; }
#card .head { background: var(--c); color: #fff; padding: 18px 20px 16px; position: relative; }
#card .head .cat { font-size: 12px; opacity: .9; }
#card h2 { font: 400 28px/1.05 var(--display); margin: 4px 0 0; text-wrap: balance; }
#card .close { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.2); border: 0; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; }
#card .body { padding: 16px 20px 20px; display: grid; gap: 14px; }
#card .body p { margin: 0; }
#card blockquote { margin: 0; padding: 10px 14px; background: rgba(240, 169, 46, .16); border-radius: 10px; font-style: italic; }
#card blockquote b { font-style: normal; display: block; font-size: 12px; color: var(--maroon); margin-bottom: 2px; }
#card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13.5px; }
#card dt { color: var(--muted); }
#card dd { margin: 0; }
#card .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { border: 1.5px solid var(--maroon); background: var(--maroon); color: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13.5px; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--maroon); }
.btn:focus-visible, #dock button:focus-visible, .chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---- dock ---- */
#dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 6px; align-items: center; background: var(--maroon); padding: 6px; border-radius: 999px; box-shadow: 0 10px 30px rgba(74, 17, 35, .35); max-width: calc(100% - 32px); overflow-x: auto; scrollbar-width: none; }
#dock button { border: 0; background: transparent; color: #fff; padding: 8px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
#dock button:hover { background: rgba(255,255,255,.14); }
#dock button[aria-pressed="true"] { background: var(--gold); color: var(--maroon-deep); }
.count { background: rgba(255,255,255,.22); border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 2px; font-variant-numeric: tabular-nums; }
#dock .time { display: flex; align-items: center; gap: 6px; color: #fff; font-size: 13px; padding: 0 6px 0 10px; }
#dock input[type=range] { width: 110px; accent-color: var(--gold); }

/* ---- panels ---- */
#panel { position: absolute; left: 50%; transform: translateX(-50%); bottom: 80px; width: min(560px, calc(100% - 32px)); max-height: min(70vh, 640px); overflow-y: auto; background: var(--paper); border-radius: 18px; box-shadow: 0 16px 50px rgba(74, 17, 35, .3); padding: 20px 22px; }
#panel h3 { font: 400 26px/1.1 var(--display); color: var(--maroon); margin: 0 0 4px; }
#panel h4 { margin: 18px 0 8px; font-size: 15px; color: var(--maroon); }
#panel .lede { margin: 0 0 12px; color: var(--muted); }
#panel .close { position: sticky; float: right; top: 0; border: 0; background: rgba(123,30,58,.1); color: var(--maroon); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.tours { display: grid; gap: 8px; }
.tours button { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; cursor: pointer; }
.tours button:hover { border-color: var(--maroon); }
.tours b { display: block; color: var(--maroon); }
.tours span { font-size: 13px; color: var(--muted); }
.plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: stop; }
.plan li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.plan li::before { counter-increment: stop; content: counter(stop); width: 26px; height: 26px; border-radius: 50%; background: var(--maroon); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.plan .leg { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); padding: 0 0 4px; }
.plan .leg::before { display: none; }
.plan li.leg::before { content: none; counter-increment: none; width: 0; }
.plan .rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.total { margin-top: 10px; font-weight: 700; }
.slang { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.slang button { min-height: 74px; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 10px; cursor: pointer; text-align: left; }
.slang button b { font: 400 18px/1.1 var(--display); color: var(--maroon); }
.slang button span { display: none; font-size: 12.5px; margin-top: 4px; }
.slang button[aria-expanded="true"] { background: rgba(139,108,199,.12); border-color: var(--jacaranda); }
.slang button[aria-expanded="true"] span { display: block; }
.survival { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; font-size: 14px; }
.survival dt { font-weight: 700; color: var(--maroon); }
.survival dd { margin: 0; }
.bingo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bingo div { aspect-ratio: 1.3; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; text-align: center; padding: 8px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.bingo div.done { border: 2px solid var(--maroon); background: var(--maroon); color: #fff; transform: rotate(-1.5deg); }

/* ---- map labels ---- */
.pin { pointer-events: auto; cursor: pointer; display: flex; flex-direction: column; align-items: center; transform: translateY(-50%); transition: opacity .2s; user-select: none; }
.pin .tag { background: var(--paper); color: var(--ink); border: 2px solid var(--c); padding: 2px 9px 3px; border-radius: 999px; font-weight: 700; font-size: 12.5px; white-space: nowrap; box-shadow: 0 3px 10px rgba(74,17,35,.2); }
.pin .stem { width: 2px; height: 14px; background: var(--c); }
.pin .foot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px rgba(255,255,255,.7); }
.pin:hover .tag, .pin.active .tag { background: var(--c); color: #fff; }
.pin.hide { opacity: 0; pointer-events: none; }
.pin.dim { opacity: .35; }
.ferry { pointer-events: none; font-size: 10.5px; font-weight: 700; color: #1d3f8f; background: rgba(255,255,255,.85); border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.ferry::before { content: ''; display: inline-block; width: 6px; height: 6px; background: #2f7de1; border-radius: 1px; margin-right: 4px; vertical-align: 1px; }
.edge { pointer-events: auto; cursor: pointer; background: var(--maroon-deep); color: #fbe3c8; padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 12.5px; white-space: nowrap; box-shadow: 0 3px 0 #2b0a15; }
.edge small { display: block; font-weight: 400; opacity: .8; font-size: 11px; }

#credit { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(6px, env(safe-area-inset-bottom)); margin: 0; font-size: 11px; color: var(--maroon-deep); background: rgba(255,250,247,.75); padding: 2px 8px; border-radius: 6px; z-index: 2; }
#credit a { color: inherit; }
@media (max-width: 820px) { #credit { bottom: auto; top: 64px; } }
#toast { position: absolute; left: 50%; top: 22px; transform: translate(-50%, -140%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; max-width: min(460px, calc(100% - 32px)); transition: transform .35s cubic-bezier(.2,1.4,.4,1); box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 5; }
#toast.show { transform: translate(-50%, 0); }
#toast b { color: var(--gold); }

#loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--maroon); color: #fbe3c8; text-align: center; transition: opacity .6s; z-index: 10; }
#loading h2 { font: 400 44px/1 var(--display); margin: 0 0 8px; color: var(--gold); }
#loading.done { opacity: 0; pointer-events: none; }

@media (max-width: 820px) {
  #brand p { display: none; }
  #status { padding: 8px 10px; max-width: 180px; }
  #status .note:not(#weather) { display: none; }
  #side { top: auto; bottom: 74px; left: 16px; right: 16px; width: auto; height: 46px; }
  #side.open { height: 52vh; }
  #side .chips, #side #list { display: none; }
  #side.open .chips, #side.open #list { display: flex; }
  #side.open #list { display: block; }
  #card { left: 16px; right: 16px; width: auto; top: auto; bottom: 74px; max-height: 62vh; }
  #dock { left: 16px; right: 16px; transform: none; max-width: none; border-radius: 16px; }
  #dock .time input { width: 80px; }
  #panel { bottom: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  #toast, .pin, #loading { transition: none; }
}

/* Clean view: the map and the dock, nothing else floating over it. (The elements stay in the
   DOM because the UI code still keeps them up to date.) */
#brand, #status, #side, #labels, #credit { display: none; }
