:root { --sea: #1a6f9a; --ink: #2c2416; --paper: #f0e4c4; --edge: #8a6f3e; --deep: #5a4522; --r: 12px; --dock: 72px;
  --shadow: 0 2px 0 rgb(0 0 0 / .18), 0 6px 18px rgb(0 0 0 / .22); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sea); color: var(--ink);
  font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
#map { position: fixed; inset: 0; }
#map canvas { image-rendering: pixelated; }
button { min-width: 44px; height: 44px; padding: 0 12px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 15px; cursor: pointer; }
button:hover { background: #e2d2a4; }
button:focus-visible { outline: 3px solid #186a96; outline-offset: -3px; }
button[aria-pressed="false"] { opacity: .55; }
.pill, #rail, #mini, #places, #card, #about { background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow); }
.pill { height: 40px; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.pill[aria-pressed="false"] { opacity: 1; }
.pill[aria-pressed="true"], .pill[aria-expanded="true"] { background: var(--deep); color: var(--paper); }

#brand { position: fixed; top: 16px; left: 16px; display: flex; align-items: center; gap: 12px; }
h1 { margin: 0; color: #fff8e6; font-size: 20px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  text-shadow: -2px 0 var(--ink), 2px 0 var(--ink), 0 -2px var(--ink), 0 2px var(--ink), 2px 2px var(--ink), -2px 2px var(--ink), 2px -2px var(--ink), -2px -2px var(--ink), 0 4px rgb(0 0 0 / .35); }
#brand .pill { height: 32px; padding: 0 12px; font-size: 12px; }

#mini { position: fixed; top: 16px; right: 16px; width: 260px; height: 64px; overflow: hidden; background: var(--sea); }
#rail { position: fixed; top: 96px; right: 16px; display: flex; flex-direction: column; overflow: hidden; }
#rail button { border-radius: 0; font-weight: 600; }
#rail hr { width: 60%; margin: 2px auto; border: 0; border-top: 2px solid rgb(138 111 62 / .45); }
#motion[aria-pressed="false"], #info { opacity: 1; }
#info { font-family: Georgia, serif; font-style: italic; font-weight: 700; }

#actions { position: fixed; right: 16px; bottom: 16px; display: flex; gap: 8px; }
#actions button { padding: 0 16px; }
#actions button:not(.pill) { height: 40px; background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; }
#actions button[aria-pressed="false"] { opacity: 1; }
#actions button[aria-pressed="true"] { background: var(--deep); color: var(--paper); }
#osm { position: fixed; left: 10px; bottom: 6px; padding: 1px 6px; border-radius: 6px; background: rgb(240 228 196 / .75); color: var(--ink); font-size: 10px; text-decoration: none; }
#osm:hover { text-decoration: underline; }

#about { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 20px 24px 16px; color: var(--ink); overflow: auto; }
#about::backdrop { background: rgb(16 40 56 / .45); }
#about h2 { margin: 0 32px 6px 0; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
#about h3 { margin: 16px 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6d5730; }
#about p { margin: 0 0 8px; }
#about a { color: inherit; }
#about .by { margin-top: -4px; font-weight: 600; }
#about .close { position: absolute; top: 10px; right: 10px; border-radius: 50%; font-size: 22px; }
#time[hidden] { display: none; }
#eras { display: flex; border: 2px solid var(--edge); border-radius: var(--r); overflow: hidden; margin-bottom: 6px; }
#eras button { position: relative; flex: 1; padding-top: 18px; font-weight: 600; opacity: 1; }
#eras button::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 2px; background: currentColor; opacity: .45; }
#eras button:first-child::before { left: 50%; }
#eras button:last-child::before { right: 50%; }
#eras button::after { content: ""; position: absolute; top: 6px; left: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
#eras button[aria-pressed="true"] { background: var(--deep); color: var(--paper); }
#time p { font-size: 11px; }

#places { position: fixed; top: 76px; left: 16px; bottom: calc(var(--dock) + 8px); width: min(320px, calc(100vw - 32px)); display: flex; flex-direction: column; overflow: hidden; }
#places[hidden], #card[hidden] { display: none; }
#card { position: fixed; left: 50%; bottom: calc(var(--dock) + 8px); transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); display: flex; align-items: center; overflow: hidden; }
#card button { flex: none; }
.label { padding: 1px 6px; background: var(--paper); border: 1px solid var(--edge); white-space: nowrap; font-size: 12px; font-weight: 600; pointer-events: none; }
.label.fort { background: #5a4522; color: var(--paper); font-weight: 400; font-size: 11px; }
#traffic { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* OpenSeadragon writes display:block on overlays, so tiers have to hide with visibility. */
.label { visibility: hidden; }
.label.t0 { visibility: visible; font-size: 16px; }
[data-tier="1"] .t1, [data-tier="2"] .t1, [data-tier="3"] .t1, [data-tier="2"] .t2, [data-tier="3"] .t2, [data-tier="3"] .t3 { visibility: visible; }
.no-labels .label { visibility: hidden !important; }
#search { margin: 8px; padding: 8px; border: 2px solid var(--edge); background: #fbf5e4; color: inherit; font: inherit; font-size: 16px; }
#search:focus-visible { outline: 3px solid #186a96; outline-offset: -1px; }
#place-list { overflow-y: auto; padding: 0 0 8px; }
#place-list h2 { margin: 10px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6d5730; }
#place-list .none { margin: 4px 10px; }
#place-list .place { display: block; width: 100%; height: auto; padding: 6px 10px; border: 0; text-align: left; font-size: 13px; }
#place-list .place b { display: block; font-weight: 600; }
#place-list .place span { display: block; font-size: 11px; color: #54462c; }
#place-list .place[aria-current="true"] { background: #5a4522; color: var(--paper); }
#place-list .place[aria-current="true"] span { color: var(--paper); }
#card-text { flex: 1; min-width: 0; padding: 6px 10px; }
#card-text strong { font-size: 14px; }
#card-text p { margin: 0; font-size: 11px; }
.label.same { visibility: hidden !important; }
.pin { padding: 2px 8px; background: #186a96; color: #fff; border: 2px solid #0e3f5a; white-space: nowrap; font-size: 13px; font-weight: 600; pointer-events: none; }
#mini .displayregion { border: 2px solid #fff !important; }

@media (min-width: 601px) and (max-width: 899px) {
  #places { top: 148px; }
}
@media (max-width: 600px) {
  :root { --dock: 64px; }
  #brand { top: 12px; left: 12px; gap: 8px; }
  h1 { font-size: 16px; letter-spacing: .05em; }
  #mini { display: none !important; }
  #rail { top: 64px; right: 12px; }
  #actions { left: 12px; right: 12px; bottom: 20px; }
  #actions button { flex: 1; padding: 0 4px; }
  #osm { bottom: 2px; }
  #places { top: 116px; left: 12px; right: 68px; width: auto; }
  #card { left: 12px; right: 12px; width: auto; transform: none; }
}
