:root {
  --bg: #161616;
  --ink: #e8e4dc;
  --mute: #8a8580;
  --line: #2a2a2a;
  --hub: #d4a017;
  --house: #c4a574;
  --room: #8aa0b4;
  --unwalked: #4a5560;
  --barrier: #a65d4e;
  --outside: #3a3a3a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: Georgia, "Times New Roman", serif; }
a { color: var(--hub); }

header {
  position: absolute;
  z-index: 2;
  left: 1.25rem;
  top: 1rem;
  right: 18rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  pointer-events: none;
}
header h1 { margin: 0; font-size: 1.35rem; font-weight: normal; letter-spacing: 0.04em; }
header .quip { margin: 0.35rem 0 0; color: var(--mute); font-style: italic; font-size: 0.95rem; }
header .toggle { pointer-events: auto; color: var(--mute); font-size: 0.85rem; white-space: nowrap; background: none; border: 0; font-family: inherit; cursor: pointer; padding: 0; }
header .toggles { pointer-events: auto; display: flex; gap: 0.9rem; }

#stage { position: relative; height: 100%; }
#map { width: 100%; height: 100%; display: block; cursor: grab; }
#map.dragging { cursor: grabbing; }

#inspect {
  position: absolute;
  top: 0;
  right: 0;
  width: 17rem;
  height: 100%;
  padding: 1.25rem 1.1rem 2rem;
  background: #121212;
  border-left: 1px solid var(--line);
  overflow: auto;
  font-size: 0.92rem;
}
#inspect .kind { margin: 0; color: var(--mute); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
#inspect h2 { margin: 0.35rem 0 0.75rem; font-size: 1.15rem; font-weight: normal; }
#inspect p { margin: 0.4rem 0; color: #cfc8bc; line-height: 1.45; }
#inspect code { font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; color: #9ccc9c; word-break: break-all; }
#inspect ul { margin: 0.4rem 0; padding-left: 1.1rem; color: #cfc8bc; }
#inspect blockquote { margin: 0.45rem 0; padding: 0 0 0 0.7rem; border-left: 2px solid var(--hub); color: #cfc8bc; font-style: italic; }

#legend {
  position: absolute;
  left: 1.25rem;
  bottom: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--mute);
  font-size: 0.78rem;
  pointer-events: none;
}
#legend li { display: flex; align-items: center; gap: 0.4rem; margin: 0.15rem 0; }
#legend i { width: 0.55rem; height: 0.55rem; border-radius: 50%; display: inline-block; }
#legend i.hub { background: var(--hub); }
#legend i.house { background: var(--house); }
#legend i.room { background: var(--room); }
#legend i.unwalked { background: var(--unwalked); }
#legend i.barrier { background: var(--barrier); border-radius: 0.05rem; }
#legend i.outside { background: var(--outside); }

.link { stroke: #3a3a3a; stroke-width: 1; fill: none; }
.link.riser { stroke: var(--hub); stroke-opacity: 0.45; }
.link.hall { stroke: #5a6a78; stroke-opacity: 0.55; }
.link.porch { stroke: var(--house); stroke-opacity: 0.35; }
.link.blocked { stroke: var(--barrier); stroke-dasharray: 3 3; }
.link.outside { stroke: #2a2a2a; }
.link.dim { stroke-opacity: 0.08; }

.node { cursor: pointer; }
.node.hub { fill: var(--hub); }
.node.house { fill: var(--house); }
.node.room { fill: var(--room); }
.node.unwalked { fill: var(--unwalked); }
.node.barrier { fill: var(--barrier); }
.node.outside { fill: var(--outside); }
.node.dim { opacity: 0.12; }

.label { fill: #cfc8bc; font-size: 11px; font-family: Georgia, serif; pointer-events: none; }
.label.dim { opacity: 0.15; }

#manhole {
  position: absolute;
  z-index: 3;
  left: 1.35rem;
  bottom: 8.6rem;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: 3px solid #7a6a3a;
  background:
    radial-gradient(circle at 50% 50%, #2a2a2a 0 18%, transparent 19% 28%, #2a2a2a 29% 31%, transparent 32% 70%, #3a3428 71%);
  color: var(--hub);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px #4a4030;
}
#manhole:hover { border-color: var(--hub); color: #e8d48a; }

#doors {
  position: absolute;
  z-index: 2;
  left: 5.2rem;
  bottom: 1rem;
  width: 22rem;
  font-size: 0.78rem;
  color: #cfc8bc;
  pointer-events: auto;
}
#doors .kind { margin: 0; color: var(--mute); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; }
#doors ul { margin: 0.2rem 0; padding-left: 1.1rem; }

#cover {
  position: absolute;
  z-index: 2;
  left: 5.2rem;
  bottom: 7.4rem;
  width: 22rem;
  max-height: 28vh;
  overflow: auto;
  font-size: 0.78rem;
  color: #cfc8bc;
  pointer-events: auto;
}
#cover .kind { margin: 0; color: var(--mute); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; }
#cover h2 { margin: 0.15rem 0 0.35rem; font-size: 0.95rem; font-weight: normal; }
#cover h3 { margin: 0.5rem 0 0.2rem; font-size: 0.8rem; font-weight: normal; color: var(--mute); }
#cover p { margin: 0.25rem 0; line-height: 1.4; }
#cover ul { margin: 0.2rem 0; padding-left: 1.1rem; }
