/* The walkable precinct page. Tokens and .btn come from app.css. */
html { scroll-behavior: smooth; }
body.precinct { overflow-x: hidden; }
#stage { position: relative; height: 100svh; min-height: 480px; overflow: hidden; background: #dfe9ee; user-select: none; -webkit-user-select: none; }
#stage canvas#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: 0; }
#stage[data-mode="over"] canvas#scene:active { cursor: grabbing; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; font: 500 13px var(--mono); color: var(--ink-2); background: #dfe9ee; }
#loading[hidden] { display: none; }

#tags { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; border: 1px solid rgba(28, 28, 26, .55); background: rgba(250, 248, 243, .92); color: var(--ink); font: 500 11px var(--mono); padding: 2px 6px; border-radius: 3px; white-space: nowrap; }
.tag:hover { background: #fff; }
.tag-mrt { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-park { background: #5d8a4c; border-color: #5d8a4c; color: #fff; }
.tag-road { background: #6d5f86; border-color: #6d5f86; color: #fff; }
.tag-landmark { background: #3b5870; border-color: #3b5870; color: #fff; }

.pc-panel { position: absolute; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1.5px solid var(--ink); padding: 14px 16px; font-size: 13.5px; line-height: 1.4; }
.pc-main { left: 20px; top: 76px; width: 268px; display: flex; flex-direction: column; gap: 9px; }
.pc-main h1 { font-size: 17px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.pc-panel .seg { display: flex; gap: 6px; }
.seg .btn[aria-pressed="false"] { background: transparent; color: var(--ink); }
.seg .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.pc-row { display: flex; flex-direction: column; gap: 3px; font: 500 11px var(--mono); color: var(--ink-2); }
.pc-row select, .pc-row input[type=range] { width: 100%; font: 400 13px var(--font); accent-color: var(--accent); }
.pc-row select { padding: 5px 4px; background: #fff; border: 1px solid var(--line); color: var(--ink); }
.pc-row b { color: var(--ink); font-weight: 500; }
.pc-note { margin: 0; font-size: 12px; color: var(--ink-2); min-height: 0; }
.pc-note:empty { display: none; }
.pc-check { display: flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }
.pc-check input { accent-color: var(--accent); }
.pc-legend { display: none; font-size: 11.5px; color: var(--ink-2); line-height: 1.7; }
.show-types .pc-legend { display: block; }
.pc-legend i { display: inline-block; width: 10px; height: 10px; margin: 0 3px 0 2px; background: var(--c); border: 1px solid rgba(28, 28, 26, .5); vertical-align: -1px; }
.pc-sales-legend { display: none; font-size: 11.5px; color: var(--ink-2); line-height: 1.65; }
.show-sales .pc-sales-legend { display: block; }
.pc-sales-legend i { display: inline-block; width: 10px; height: 10px; margin: 0 4px 0 2px; border-radius: 2px; vertical-align: -1px; }
.pc-sales-legend i.dot-sold { background: #ffbe2e; border: 1px solid #b57700; box-shadow: 0 0 6px #ffa814; }
.pc-sales-legend i.dot-avail { background: #ffffff; border: 1px solid #6b889c; box-shadow: 0 0 6px #9ed4ff; }
.sales-badge { margin: 0; padding: 6px 8px; border-radius: 3px; font-size: 12.5px; line-height: 1.35; font-weight: 500; border: 1px solid rgba(28, 28, 26, .22); }
.sales-badge.is-sold { background: rgba(255, 190, 46, .28); border-color: #b57700; color: #3a2400; }
.sales-badge.is-avail { background: #ffffff; border-color: #6b889c; color: #162430; box-shadow: inset 0 0 0 1px rgba(107, 136, 156, .22); }
.sales-badge.is-skip { background: rgba(28, 28, 26, .06); border-color: rgba(28, 28, 26, .2); color: var(--ink-2); font-weight: 400; }
.pc-views-legend { display: none; font-size: 11px; color: var(--ink-2); line-height: 1.65; }
.show-views .pc-views-legend { display: block; }
.pc-views-legend i { display: inline-block; width: 9px; height: 9px; margin: 0 3px 0 2px; border-radius: 2px; vertical-align: -1px; background: var(--c); border: 1px solid rgba(28, 28, 26, .35); }
.floor-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.floor-presets button { flex: 1; min-width: 34px; padding: 4px 5px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 500 11px var(--mono); border-radius: 3px; cursor: pointer; }
.floor-presets button:hover { border-color: var(--ink); }
.floor-presets button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.flat-outlook { display: flex; flex-direction: column; gap: 4px; }
.ov-pill { padding: 4px 7px; border-radius: 3px; font-size: 11.5px; line-height: 1.3; font-weight: 500; border: 1px solid rgba(28, 28, 26, .18); }
.ov-pill.is-sea { background: rgba(27, 130, 230, .14); border-color: #1b82e6; color: #0c3d6e; }
.ov-pill.is-hill { background: rgba(67, 160, 71, .14); border-color: #3d8b40; color: #164719; }
.ov-pill.is-part { background: rgba(110, 198, 255, .18); border-color: #3888b8; color: #123e59; }
.ov-pill.is-blk { background: rgba(28, 28, 26, .06); border-color: rgba(28, 28, 26, .2); color: var(--ink-2); font-weight: 400; }
.pc-stack-note { margin: 0; font: 500 11px var(--mono); color: var(--ink-2); }
.pc-hint { margin: 0; font-size: 12px; color: var(--ink-2); }
.walk-only { display: none; }
[data-mode="walk"] .walk-only { display: block; }
[data-mode="walk"] .over-only, [data-mode="view"] .over-only { display: none; }
.pc-more { font-size: 12.5px; color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }

.pc-card { right: 20px; top: 76px; width: 268px; display: flex; flex-direction: column; gap: 9px; }
.pc-card[hidden], .pc-card [hidden] { display: none; }
.pc-card a.btn { text-align: center; }
.pc-card h2 { font-size: 16px; font-weight: 600; margin: 0; padding-right: 22px; letter-spacing: -.01em; line-height: 1.25; }
.pc-card p { margin: 0; }
.pc-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink); padding: 2px 4px; }
.pc-link { font-size: 13px; color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }

@media (max-width: 720px) {
  #stage { height: 100svh; }
  .pc-main { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; padding: 9px 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-items: end; }
  .pc-main h1 { display: none; }
  .pc-main .seg { grid-column: 1 / 3; }
  .pc-main .seg .btn { flex: 1; }
  .pc-main .pc-row:first-of-type { grid-column: 1 / 2; }
  #goRoute { grid-column: 2 / 3; }
  .pc-main .pc-note, .pc-legend, .pc-sales-check, .pc-sales-legend, .pc-views-check, .pc-views-legend { grid-column: 1 / 3; }
  .pc-sun { grid-column: 1 / 2; }
  .pc-check:not(.pc-sales-check):not(.pc-views-check) { grid-column: 2 / 3; font-size: 12px; }
  .pc-hint { display: none !important; }
  .pc-more { grid-column: 1 / 3; text-align: center; }
  .pc-card { left: 8px; right: 8px; top: 62px; width: auto; }
  .tag { font-size: 10px; padding: 1px 4px; }
}

/* Walking comes first */
#startWalk { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); font-size: 16px; padding: 15px 30px; box-shadow: 0 6px 22px rgba(0,0,0,.28); }
#startWalk:hover { transform: translateX(-50%) translateY(-1px); }
#startWalk[hidden] { display: none; }
#stick { display: none; position: absolute; left: 22px; bottom: 26px; width: 128px; height: 128px; border-radius: 50%; background: rgba(250,248,243,.32); border: 1.5px solid rgba(250,248,243,.85); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); touch-action: none; }
#stick span { position: absolute; left: 34px; top: 34px; width: 60px; height: 60px; border-radius: 50%; background: rgba(250,248,243,.95); box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none; }
@media (pointer: coarse) { [data-mode="walk"] #stick { display: block; } }
.touch[data-mode="walk"] #stick { display: block; }
@media (max-width: 720px) {
  #startWalk { bottom: 240px; }
  [data-mode="walk"] .pc-main, [data-mode="view"] .pc-main { left: auto; right: 8px; bottom: 8px; width: 190px; grid-template-columns: 1fr; }
  [data-mode="walk"] .pc-main > :not(.seg):not(.pc-note), [data-mode="view"] .pc-main > :not(.seg):not(.pc-note) { display: none; }
  [data-mode="walk"] .pc-main .seg, [data-mode="walk"] .pc-main .pc-note, [data-mode="view"] .pc-main .seg, [data-mode="view"] .pc-main .pc-note { grid-column: 1; }
  [data-mode="view"] #flatCard { padding: 8px 11px; gap: 5px; }
  [data-mode="view"] #flatCard h2 { font-size: 14px; }
  [data-mode="view"] #flatCard #flatFacts, [data-mode="view"] #flatCard #seeView, [data-mode="view"] #flatCard #flatLink, [data-mode="view"] #flatCard .pc-note { display: none; }
}

.tag-school, .tag-community, .tag-shop, .tag-food, .tag-worship, .tag-health, .tag-bto, .tag-transport { font-weight: 400; background: rgba(250,248,243,.86); border-color: rgba(28,28,26,.3); }
.tag-school { border-left: 4px solid #d9a441; } .tag-community { border-left: 4px solid #5b8fb9; } .tag-shop, .tag-food { border-left: 4px solid #d9734f; } .tag-worship { border-left: 4px solid #9a7fb8; } .tag-health { border-left: 4px solid #4fa07a; } .tag-bto { border-left: 4px solid #8a8a80; } .tag-transport { border-left: 4px solid #6ebe44; }
.tag-mrt { background: #9D5B25; border-color: #9D5B25; }
.no-places .tag-school, .no-places .tag-community, .no-places .tag-shop, .no-places .tag-food, .no-places .tag-worship, .no-places .tag-health, .no-places .tag-bto, .no-places .tag-transport, .no-places .tag-park, .no-places .tag-landmark { display: none !important; }

/* Compass and "where am I" */
.where { position: absolute; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 10px; flex-direction: row-reverse; pointer-events: none; }
#compass { pointer-events: auto; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
#compass svg { display: block; width: 100%; height: 100%; }
#compassDial { transform-origin: 32px 32px; }
.where-text { margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 5px 9px; background: rgba(250,248,243,.9); border: 1px solid rgba(28,28,26,.45); border-radius: 3px; font: 500 11px/1.3 var(--mono); color: var(--ink); white-space: nowrap; }
.where-text b { font-weight: 500; }
#whereNow { color: var(--ink-2); font-weight: 400; }
#whereNow:empty { display: none; }
.tag-road { font-weight: 400; font-style: italic; }
@media (max-width: 720px) {
  .where { right: 8px; top: 62px; bottom: auto; }
  #stage:has(.pc-card:not([hidden])) .where { display: none; }
  #compass { width: 52px; height: 52px; }
  .where-text { font-size: 10px; max-width: 58vw; white-space: normal; text-align: right; }
}

/* Lines, the sea and the edge */
.tag-line { color: #fff; font-style: normal; }
.tag-sea { background: rgba(32, 72, 96, .78); border-color: rgba(32, 72, 96, .78); color: #fff; font-weight: 400; }
#edgeNote { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); margin: 0; padding: 7px 14px; background: rgba(28,28,26,.86); color: #fff; font: 500 12px var(--mono); border-radius: 3px; pointer-events: none; }
#edgeNote[hidden] { display: none; }

/* A block's card: how far things are on foot */
#blockCard { max-height: calc(100svh - 110px); overflow-y: auto; overscroll-behavior: contain; }
.walks { display: flex; flex-direction: column; margin: 0 -4px; }
.walks h3 { margin: 6px 4px 2px; font: 500 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.walk { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 6px 4px; border: 0; border-top: 1px solid rgba(28,28,26,.12); background: none; text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.walk:hover { background: rgba(255,255,255,.55); }
.walk.on { background: rgba(214,102,46,.14); box-shadow: inset 3px 0 0 #d6662e; }
.w-n { display: flex; flex-direction: column; min-width: 0; }
.w-n b { font-weight: 500; font-size: 13px; line-height: 1.25; }
.w-n b.dot::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--dot); vertical-align: 0; }
.w-n small { font-size: 11.5px; color: var(--ink-2); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.w-d { display: flex; flex-direction: column; align-items: flex-end; flex: none; font: 400 11.5px var(--mono); color: var(--ink-2); }
.w-d b { font-weight: 500; color: var(--ink); font-size: 12.5px; }
.pc-more-btn { align-self: flex-start; border: 0; background: none; padding: 0; font-size: 12.5px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; cursor: pointer; }
.pc-more-btn[hidden] { display: none; }
.walk-pick { display: none; }
.walk-now { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.walk-now[hidden] { display: none; }
@media (min-width: 721px) { .walk-now { display: none; } }
#blockCard .pc-note:last-child { font-size: 11px; }
@media (max-width: 720px) {
  #blockCard { top: 62px; padding: 9px 12px; gap: 6px; }
  #blockCard #blockFacts, #blockRoute, #blockCard .walks, #walksMore, #blockCard .pc-note:last-child { display: none; }
  #blockCard h2 { font-size: 15px; }
  .walk-pick { display: flex; }
  .walk { padding: 5px 4px; }
}
