:root {
  --paper: #f3eee4;
  --ink: #2b2a27;
  --soft: #6f6a60;
  --hair: rgba(43, 42, 39, .16);
  --card: rgba(250, 247, 240, .92);
  --accent: #c8553d;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --sans: -apple-system, "Helvetica Neue", "PingFang SC", "Segoe UI", Arial, sans-serif;
}
/* Japanese and Korean: their own CJK fonts ahead of the Chinese ones, so kanji take Japanese shapes and Hangul a Korean face */
:root:lang(ja) {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", Georgia, serif;
  --sans: -apple-system, "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", "Segoe UI", Arial, sans-serif;
}
:root:lang(ko) {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "AppleMyungjo", "Noto Serif CJK KR", "Batang", Georgia, serif;
  --sans: -apple-system, "Helvetica Neue", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", "Segoe UI", Arial, sans-serif;
}
/* Korean breaks lines between words (at spaces), not between any two syllables */
:root:lang(ko) body { word-break: keep-all; overflow-wrap: break-word; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 12px; -webkit-font-smoothing: antialiased; }
body.live { overflow: hidden; }
#stage { position: fixed; inset: 0; touch-action: none; }
#stage canvas { display: block; width: 100%; height: 100%; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.kicker { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--soft); margin: 0 0 6px; font-weight: 500; }

/* title, on a soft veil so it stays readable over the map */
.live #ui::before { content: ''; position: absolute; left: 0; top: 0; width: 560px; height: 230px; pointer-events: none; background: radial-gradient(ellipse at 0 0, rgba(243, 238, 228, .94) 0, rgba(243, 238, 228, .75) 45%, rgba(243, 238, 228, 0) 72%); }
#title { position: absolute; left: 28px; top: 22px; max-width: 330px; pointer-events: none !important; }
#title h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.05; margin: 0 0 6px; letter-spacing: -.01em; }
#title p { margin: 0; color: var(--soft); font-size: 12px; line-height: 1.45; border-top: 1px solid var(--hair); padding-top: 7px; }
#title .progress { margin-top: 8px; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink); }

/* pills */
.pill { font: inherit; font-size: 11px; color: var(--ink); background: var(--card); border: 1px solid var(--hair); border-radius: 999px; padding: 5px 11px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.pill:hover { border-color: var(--ink); }
.pill.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* stop list */
#list { position: absolute; right: 16px; top: 64px; bottom: 70px; width: 240px; background: var(--card); border: 1px solid var(--hair); border-radius: 16px; padding: 14px 8px 10px 16px; overflow-y: auto; backdrop-filter: blur(6px); scrollbar-width: thin; }
#stops { list-style: none; margin: 0; padding: 0; }
#stops li { display: flex; gap: 10px; align-items: baseline; padding: 5px 4px; border-top: 1px solid var(--hair); cursor: pointer; color: var(--soft); }
#stops li:hover { color: var(--accent); }
#stops li .n { flex: 0 0 18px; font-size: 10px; font-variant-numeric: tabular-nums; }
#stops li .nm { font-family: var(--serif); font-size: 14px; }
#stops li.done { color: var(--ink); }
#stops li.cur { color: var(--accent); }
#stops li.cur .nm { font-weight: 600; }

/* text card */
#card { position: absolute; left: 28px; bottom: 70px; width: 330px; background: var(--card); border: 1px solid var(--hair); border-radius: 14px; padding: 16px 18px; backdrop-filter: blur(6px); }
#card.in { animation: cardIn .45s ease-out; }
#card.away { opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .3s, transform .3s, visibility 0s .3s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#card h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1.1; margin: 2px 0 8px; }
#card p { margin: 0; line-height: 1.55; font-size: 13px; }
#card .nb { white-space: nowrap; }
#card .next { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hair); color: var(--soft); font-size: 11px; }
#card .next:empty { display: none; }
#card .pill { margin-top: 10px; }

/* control bar */
#bar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: var(--card); border: 1px solid var(--hair); border-radius: 999px; padding: 6px 10px; backdrop-filter: blur(6px); max-width: calc(100vw - 24px); overflow-x: auto; }
#bar .sep { width: 1px; height: 16px; background: var(--hair); flex: none; }
#bar .pill { border-color: transparent; background: transparent; padding: 5px 9px; }
#bar .pill:hover { border-color: var(--hair); }
#bar .pill.on { background: var(--ink); }
#bar .pill.continue, #bar .pill.continue:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.only-narrow { display: none; }

/* walking hint, until the visitor first walks by hand */
#hint { position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); font-size: 11px; color: var(--soft); background: var(--card); border: 1px solid var(--hair); border-radius: 999px; padding: 4px 12px; white-space: nowrap; pointer-events: none !important; backdrop-filter: blur(6px); transition: opacity .4s; }
#hint.gone { opacity: 0; }

/* map labels */
.lab3 { position: absolute; left: 0; top: 0; font-size: 10px; background: rgba(250, 247, 240, .88); border: 1px solid var(--hair); border-radius: 999px; padding: 1px 7px; white-space: nowrap; will-change: transform; }
.lab3.cur { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* the text list: what search engines and visitors without WebGL read */
#stops-ssr { max-width: 640px; margin: 140px auto 60px; padding: 0 24px; list-style: none; counter-reset: s; }
#stops-ssr li { border-top: 1px solid var(--hair); padding: 14px 0; counter-increment: s; }
#stops-ssr h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 0 0 6px; }
#stops-ssr h2::before { content: counter(s, decimal-leading-zero) "  "; font-family: var(--sans); font-size: 11px; color: var(--soft); }
#stops-ssr p { margin: 0; line-height: 1.6; font-size: 14px; }
.live #stops-ssr { display: none; }
body:not(.live) #ui { position: static; }
body:not(.live) #ui > :not(#title) { display: none; }
body:not(.live) #title { position: static; max-width: 640px; margin: 40px auto 0; padding: 0 24px; }
body:not(.live) #title p { display: block; }
body:not(.live) #stops-ssr { margin-top: 28px; }

@media (max-width: 820px) {
  #title { left: 14px; top: 12px; max-width: 200px; }
  #title h1 { font-size: 22px; } #title p { display: none; }
  #list { display: none; top: 56px; right: 10px; bottom: auto; max-height: 60vh; width: 220px; z-index: 2; }
  #list.open { display: block; }
  #card { left: 10px; right: 10px; width: auto; bottom: 62px; max-height: 34vh; overflow-y: auto; padding: 12px 14px; }
  #card h2 { font-size: 21px; }
  #card p { font-size: 12.5px; }
  #bar { bottom: 10px; }
  #hint { left: 14px; right: auto; transform: none; top: 84px; bottom: auto; white-space: normal; max-width: calc(100vw - 28px); }
  .only-narrow { display: inline-block; }
  #bar { gap: 2px; padding: 5px 6px; }
  #bar .pill { padding: 5px 8px; }
  #bar .lbl { display: none; }
}
