:root {
  color-scheme: light;
  --paper: #f5f1e7;
  --panel: #fcfaf3;
  --ink: #354b4c;
  --muted: #596968;
  --line: #d9dbcc;
  --accent: #447e7a;
  --accent-hover: #3a6f6b;
  --accent-text: #3a6f6b;
  --on-accent: #fff;
  --gold: #b18b50;
  --gold-text: #7e5d2d;
  --soft: #e8e8db;
  --water: #c2dcdf;
  --map-label: #2b4c53;
  font-family: Inter, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  min-height: 44px;
  padding: 10px 16px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: var(--soft);
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
button.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.app-shell {
  max-width: 1450px;
  margin: auto;
  padding: 0 56px;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
}
.brand-en {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  margin-left: 5px;
  padding-top: 5px;
  color: var(--muted);
}
.brand-mark {
  width: 44px;
  height: 31px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
}
.brand-mark .brand-piers {
  stroke-width: 1.7;
}
.brand-mark .brand-water {
  stroke: var(--gold);
  stroke-width: 1.7;
}
/* The English title already reads "Seven Bridges"; the subtitle only helps beside Chinese. */
:lang(en) .brand-en {
  display: none;
}
.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
nav {
  display: flex;
  gap: 12px;
}
nav button {
  border: 0;
  font-size: 13px;
}
.icon-button {
  font-size: 24px;
  width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 24px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--muted);
  margin: 0 0 14px;
}
h1 {
  font-family: 'Songti SC', 'Noto Serif CJK SC', Georgia, serif;
  font-size: 42px;
  font-weight: 500;
  letter-spacing: 2px;
  margin: 0 0 12px;
}
.intro p:last-child {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.8px;
}
.daily-link {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 5px 10px;
  text-align: left;
  padding: 15px 21px;
  border-radius: 9px;
  font-size: 13px;
}
.daily-link > span:first-child {
  grid-row: span 2;
  align-self: center;
  color: var(--accent);
}
.daily-link .icon {
  width: 26px;
  height: 26px;
}
.daily-link small {
  font-family: monospace;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1px;
}
.journey-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0 36px;
  grid-template-areas: 'map journal' 'controls journal';
  grid-template-rows: min-content 1fr;
  align-items: start;
}
.map-panel {
  grid-area: map;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--water);
  border: 1px solid #b8cdd0;
  display: flex;
  flex-direction: column;
}
.map-panel:has(#complete-banner:not([hidden])) {
  --completion-space: 86px;
}
.map-topline,
.map-bottomline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  color: var(--map-label);
  font-size: 11px;
  letter-spacing: 1.8px;
  z-index: 1;
}
.map-topline {
  border-bottom: 1px solid #fff4;
}
.map-bottomline {
  gap: 8px;
  padding-top: 14px;
  padding-bottom: 18px;
}
.map-bottomline > span:nth-child(2) {
  letter-spacing: 0;
  font-size: 12px;
  text-align: center;
}
.map-bottomline > span:first-child,
.compass {
  flex: none;
  white-space: nowrap;
}
.stage {
  flex: 1;
  min-height: 0;
  touch-action: none;
  position: relative;
  /* The scene's water bleeds past its viewBox to fill whatever shape the panel takes. */
  overflow: hidden;
  display: grid;
  place-items: center;
}
.city-scene {
  display: block;
  width: 100%;
  height: clamp(180px, calc(100dvh - 440px - var(--completion-space, 0px)), 600px);
  overflow: visible;
}
.terrain,
.terrain-props,
.streets,
.sky,
.abutments,
.lamps,
.water-texture,
.node-dot,
.node-letter,
.bridge-deck,
.bridge-rail {
  transition:
    opacity 0.45s,
    stroke 0.45s,
    fill 0.45s,
    stroke-width 0.45s;
}
.bridge.actionable {
  cursor: pointer;
}
.bridge-halo {
  fill: none;
  stroke: #fff6dc;
  stroke-width: 36;
  stroke-linecap: round;
  opacity: 0;
  pointer-events: none;
}
.bridge.available .bridge-halo {
  opacity: 0.7;
  animation: bridge-ready 1.8s ease-in-out infinite alternate;
}
.bridge.walked .bridge-halo {
  stroke: #ffcf73;
  opacity: 0.4;
}
@keyframes bridge-ready {
  from {
    opacity: 0.3;
  }
  to {
    opacity: 0.85;
  }
}
.street {
  fill: none;
  stroke: #efe7cd;
  stroke-width: 9;
  stroke-linecap: round;
}
.street.walked {
  stroke: #f4cf8a;
}
.street.removed {
  opacity: 0.3;
}
.abutment,
.abutment-cap {
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
}
.abutment {
  stroke: #6f6a55;
  stroke-width: 8;
}
.abutment-cap {
  stroke: #e2d8bd;
  stroke-width: 4;
}
.bridge.walked .abutment-cap {
  stroke: #ffe2a8;
}
.bridge.ghost .abutments {
  opacity: 0;
}
.lamps {
  fill: #fff1c9;
  stroke: #c98a3a;
  stroke-width: 1.5;
  pointer-events: none;
  filter: drop-shadow(0 0 4px #ffcf73);
}
.plaza-glow {
  opacity: 0;
}
.bridge-shadow {
  fill: none;
  stroke: var(--bridge-shadow-color, #3b6775);
  stroke-width: 25;
  opacity: var(--bridge-shadow-opacity, 0.18);
  pointer-events: none;
}
.bridge-rail {
  fill: none;
  stroke: #716b56;
  stroke-width: 19;
  pointer-events: none;
}
.bridge-deck {
  fill: none;
  stroke-width: 14;
  pointer-events: none;
}

.bridge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 40;
  pointer-events: stroke;
}
/* Map elements show focus on their own shape; a box around a curved bridge reads as a frame. */
.city-scene [tabindex]:focus-visible {
  outline: none;
}
.bridge:focus-visible .bridge-halo {
  stroke: #fff;
  opacity: 0.95;
  animation: none;
}
.node:focus-visible .node-dot {
  stroke: var(--gold);
  stroke-width: 5;
  opacity: 1;
}
.bridge.available .bridge-rail {
  stroke: #4f7f76;
}
.bridge.actionable:hover .bridge-rail,
.bridge:focus .bridge-rail {
  stroke: #4d8479;
  stroke-width: 24;
}
.bridge.walked .bridge-rail {
  stroke: #b99054;
}
.bridge.hinted .bridge-rail {
  stroke: #e79748;
  stroke-width: 25;
}
.bridge.ghost .bridge-deck {
  stroke: #3d8592;
  stroke-dasharray: 8 7;
  stroke-width: 3;
}
.bridge.ghost .bridge-rail,
.bridge.ghost .bridge-shadow,
.bridge.ghost .material-detail {
  opacity: 0;
}
.bridge.removed {
  opacity: 0.2;
}
.node.actionable {
  cursor: pointer;
}
.node-dot {
  fill: #e6e6d5;
  stroke: #738d87;
  stroke-width: 2;
  opacity: 0.7;
}
.node-letter {
  font-size: 15px;
  fill: #385b60;
  opacity: 0.8;
  pointer-events: none;
}
.node.current .node-dot {
  stroke: #d99d51;
  stroke-width: 3;
  fill: #f5e9c8;
}
.node.selected .node-dot {
  fill: #e8bd79;
  stroke: #b27634;
  stroke-width: 4;
}
.node-hit {
  pointer-events: all;
}
.land-name {
  font-size: 14px;
  fill: #2f5864;
  letter-spacing: 1px;
  pointer-events: none;
  /* A halo of water colour keeps the name readable wherever it lands. */
  paint-order: stroke;
  stroke: #e3eeec;
  stroke-width: 4px;
  stroke-linejoin: round;
  stroke-opacity: 0.85;
}
.portrait .land-name {
  font-size: 22px;
  stroke-width: 6px;
}
.portrait .node-letter {
  font-size: 19px;
}
.degree rect {
  fill: #fff5d9;
  stroke: #c99f61;
}
.degree text {
  fill: #705537;
  font-size: 13px;
}
.slot-label {
  text-anchor: middle;
  font-size: 24px;
  fill: #2c7380;
  pointer-events: none;
}
.traveler {
  pointer-events: none;
}
.traveler-ring {
  fill: #fff3d0;
  fill-opacity: 0.35;
  stroke: #d99d51;
  stroke-width: 2.5;
  animation: traveler-ring 1.6s ease-in-out infinite alternate;
}
.traveler-bob {
  animation: traveler-bob 1.2s ease-in-out infinite alternate;
}
@keyframes traveler-ring {
  from {
    stroke-opacity: 0.35;
  }
  to {
    stroke-opacity: 1;
  }
}
@keyframes traveler-bob {
  to {
    transform: translateY(-2.5px);
  }
}
.crossing-shadow {
  fill: none;
  stroke: #1f3a47;
  stroke-width: 22;
  opacity: 0.3;
  pointer-events: none;
}
.wake {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.22;
}
.sails {
  animation: sails 16s linear infinite;
}
@keyframes sails {
  to {
    transform: rotate(360deg);
  }
}
.graph-view .terrain,
.graph-view .terrain-props,
.graph-view .streets,
.graph-view .sky,
.graph-view .water-texture {
  opacity: 0.08;
}
.graph-view .bridge-shadow,
.graph-view .crossing-shadow,
.graph-view .material-detail,
.graph-view .abutments,
.graph-view .lamps {
  opacity: 0;
}
/* The lens reads edges node to node, so bridges are no longer cut at the quay. */
.graph-view .span {
  mask: none;
}
.graph-view .bridge-halo {
  stroke-width: 18;
}
.graph-view .bridge-rail {
  stroke-width: 5;
  stroke: #67858c;
}
.graph-view .bridge-deck {
  stroke-width: 2;
  stroke: #638991;
}
.graph-view .bridge.walked .bridge-deck {
  stroke: #c6893d;
  stroke-width: 5;
}
.graph-view .node-dot {
  opacity: 1;
  fill: #f4f2e7;
  stroke: #719093;
}
.graph-view .bridge.ghost .bridge-deck {
  stroke-dasharray: 8 7;
}
.morphing {
  pointer-events: none;
}
.blueprint {
  background: #9bc1cf;
}
.journal {
  grid-area: journal;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}
.journal h2 {
  font-family: 'Songti SC', Georgia, serif;
  font-weight: 500;
  font-size: 26px;
  margin: 0 0 18px;
}
.objective {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0 0 24px;
}
.progress {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 19px 0;
}
.progress > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.progress strong {
  font:
    30px Georgia,
    serif;
  letter-spacing: 1px;
}
.progress span {
  font-size: 12px;
  color: var(--muted);
}
.progress-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 13px;
}
.progress-dots i {
  height: 4px;
  min-width: 8px;
  flex: 1;
  background: var(--line);
  border-radius: 2px;
}
.progress-dots i.lit {
  background: var(--gold);
}
.endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin: 17px 0;
  color: var(--muted);
}
.route-journal {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 16px;
}
.route-journal h3 {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 8px 0 12px;
}
#route-history {
  font: 14px monospace;
  color: var(--accent-text);
  line-height: 2;
  min-height: 30px;
  overflow-wrap: anywhere;
}
.message {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  min-height: 44px;
  margin: 0 0 12px;
}
.journal button {
  font-size: 12px;
  padding: 10px;
  width: 100%;
  margin-bottom: 8px;
}
.toolbar {
  grid-area: controls;
  display: flex;
  gap: 12px;
  min-width: 0;
  margin: 12px 0 20px;
}
.toolbar button {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  border: 0;
  padding: 9px 12px;
}
.toolbar button > span:first-child {
  display: inline-grid;
  color: var(--accent);
}
.toolbar-spacer {
  flex: 1;
}
footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 23px 0 30px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}
footer i {
  margin: 0 10px;
}
footer a:hover {
  text-decoration: underline;
}
#complete-banner {
  position: relative;
  flex: none;
  margin: 0 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fcfaf3ed;
  border: 1px solid #d0c19e;
  padding: 14px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 30px #24465512;
}
#complete-banner[hidden] {
  display: none;
}
#complete-banner strong {
  font:
    19px Georgia,
    'Songti SC',
    serif;
  color: #685735;
}
#complete-banner small {
  display: block;
  margin-top: 6px;
  color: var(--gold-text);
  font-size: 12px;
}
#complete-banner button {
  font-size: 12px;
}
.save-warning {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  background: #f3dfc7;
  color: #6d4933;
  border: 1px solid #c9925a;
  padding: 10px 16px;
  border-radius: 8px;
  margin: 15px 0;
}
.save-warning[hidden] {
  display: none;
}
dialog {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 15px;
  max-width: 860px;
  width: calc(100% - 32px);
  padding: 28px;
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 25px 100px #1a394533;
}
dialog::backdrop {
  background: #23414b77;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.dialog-head h2 {
  font:
    26px 'Songti SC',
    Georgia,
    serif;
  font-weight: 500;
  margin: 0;
}
.dialog-head button {
  border: 0;
}
.dialog-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.chapter {
  margin-bottom: 24px;
}
.chapter-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.chapter-heading small {
  color: var(--muted);
  font-size: 11px;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.level-card {
  min-height: 96px;
  text-align: left;
  background: var(--paper);
  padding: 13px;
  font-size: 12px;
  line-height: 1.8;
}
.level-card strong {
  display: block;
  font:
    20px Georgia,
    serif;
  color: var(--accent-text);
  margin-bottom: 6px;
}
.level-card small {
  font-size: 11px;
  color: var(--gold-text);
}
.dialog-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.dialog-tabs button {
  font-size: 12px;
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.settings-row select {
  font: 16px inherit;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  max-width: 60%;
}
.help-copy {
  font-size: 14px;
  line-height: 2.1;
}
.works-list {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}
.works-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  text-align: left;
}
.works-list button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
}
#engineering small {
  font-size: 11px;
  color: var(--muted);
}
#discovery .pairing {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  color: var(--gold-text);
  font-size: 21px;
}
.stamp {
  display: inline-block;
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  line-height: 48px;
  text-align: center;
  color: var(--gold-text);
  font-size: 20px;
  transform: rotate(-8deg);
  margin-right: 10px;
}
.postcard-options {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  margin: 22px 0;
}
.postcard-options input {
  width: 20px;
  height: 20px;
}
.export-buttons {
  display: flex;
  gap: 10px;
}
.hint-card {
  background: var(--soft);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.8;
  margin-bottom: 12px;
}
[data-theme='dark'] {
  color-scheme: dark;
  --paper: #24363e;
  --panel: #2d4147;
  --ink: #e4e4d5;
  --muted: #a8bcb9;
  --line: #496065;
  --accent: #73a79b;
  --accent-hover: #8bbcb0;
  --accent-text: #9ecbc0;
  --on-accent: #142d32;
  --soft: #344a50;
  --gold: #d6b878;
  --gold-text: #d6b878;
  --water: #405760;
  --map-label: #eff8f4;
}
/* Dark theme: the harbour at dusk, drawn in its own colours rather than dimmed. */
[data-theme='dark'] .city-scene:not(.atmosphere-4) .water-a {
  stop-color: #4f6d72;
}
[data-theme='dark'] .city-scene:not(.atmosphere-4) .water-b {
  stop-color: #22404e;
}
[data-theme='dark'] .city-scene .sky {
  opacity: 0.35;
}
[data-theme='dark'] .city-scene .land {
  filter: brightness(0.8) saturate(0.9);
}
[data-theme='dark'] #complete-banner {
  background: #283d43ed;
}
[data-theme='dark'] #complete-banner strong {
  color: #e9d6a9;
}
@media (min-width: 1450px) {
  .city-scene {
    max-height: 670px;
  }
}
@media (max-width: 1050px) {
  .app-shell {
    padding: 0 30px;
  }
  .journey-layout {
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 0 24px;
  }
  .toolbar {
    min-width: 0;
  }
  .brand-en {
    display: none;
  }
  .journal h2 {
    font-size: 22px;
  }
  .intro {
    margin: 30px 0 24px;
  }
}
@media (max-width: 700px) {
  .app-shell {
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
  }
  .masthead {
    height: 70px;
  }
  .brand {
    font-size: 16px;
    gap: 7px;
    letter-spacing: 1px;
  }
  :lang(en) .brand {
    font-size: 15px;
    letter-spacing: 0.3px;
    gap: 6px;
  }
  :lang(en) #brand-title {
    white-space: nowrap;
  }
  :lang(en) nav button {
    font-size: 10px;
    padding: 6px;
  }
  .brand-mark {
    width: 34px;
    height: 24px;
  }
  nav {
    gap: 2px;
  }
  nav button {
    padding: 8px;
    font-size: 11px;
  }
  .intro {
    margin: 24px 0 18px;
    gap: 10px;
  }
  h1 {
    font-size: 29px;
    letter-spacing: 1px;
    margin-bottom: 8px;
  }
  .intro p:last-child {
    font-size: 12px;
    letter-spacing: 0;
    margin: 0;
  }
  .intro .eyebrow {
    font-size: 10px;
    letter-spacing: 2px;
    margin-bottom: 10px;
  }
  .daily-link {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    border: 0;
    padding: 0;
    min-width: 86px;
    font-size: 12px;
  }
  .daily-link > span:first-child {
    display: none;
  }
  .daily-link small {
    font-size: 11px;
    letter-spacing: 0;
  }
  .journey-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'map' 'journal' 'controls';
    grid-template-rows: auto auto auto;
    gap: 16px;
  }
  .map-topline,
  .map-bottomline {
    padding: 12px 16px;
    font-size: 10px;
    letter-spacing: 1px;
  }
  .map-bottomline > span:nth-child(2) {
    font-size: 11px;
  }
  .city-scene {
    height: auto;
    max-height: 70dvh;
    min-height: 350px;
  }
  .journal {
    position: relative;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
  }
  .journal > .eyebrow {
    grid-column: 1;
    margin-bottom: 0;
    font-size: 10px;
    letter-spacing: 1.5px;
  }
  .journal h2 {
    grid-column: 1;
    margin: 0;
    font-size: 21px;
  }
  .objective {
    grid-column: 1;
    margin: 0;
    font-size: 12px;
  }
  .progress {
    grid-column: 2;
    grid-row: 1 / span 3;
    border: 0;
    padding: 0;
    align-self: center;
    min-width: 100px;
  }
  .progress > div:first-child {
    gap: 8px;
  }
  .progress strong {
    font-size: 23px;
  }
  .progress span {
    font-size: 11px;
  }
  .endpoints {
    grid-column: 1 / span 2;
    margin: 8px 0;
    font-size: 12px;
  }
  .route-journal {
    display: none;
  }
  .message {
    grid-column: 1 / span 2;
    min-height: 0;
    font-size: 12px;
    margin: 0;
    padding-bottom: 8px;
  }
  #hint-detail,
  #journal-actions,
  #engineering,
  #discovery {
    grid-column: 1 / span 2;
  }
  .toolbar {
    max-width: none;
    position: sticky;
    bottom: 0;
    z-index: 4;
    background: var(--paper);
    border-top: 1px solid var(--line);
    margin: 10px -16px 0;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    gap: 1px;
    justify-content: space-around;
  }
  .toolbar button {
    font-size: 12px;
    padding: 8px;
    gap: 4px;
    flex-direction: column;
    min-width: 58px;
  }
  .toolbar button > span:first-child .icon {
    width: 24px;
    height: 24px;
  }
  .toolbar-spacer {
    display: none;
  }
  footer {
    padding: 20px 0;
    font-size: 11px;
    letter-spacing: 0;
  }
  footer > span:nth-child(2) {
    display: none;
  }
  #complete-banner {
    margin: 0 10px 10px;
    padding: 12px;
  }
  #complete-banner strong {
    font-size: 16px;
  }
  #complete-banner small {
    font-size: 11px;
  }
  #complete-banner button {
    padding: 9px;
    font-size: 12px;
  }
  .level-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  dialog {
    padding: 20px;
  }
  .settings-row select {
    max-width: 55%;
  }
}
@media (max-height: 550px) and (min-width: 701px) {
  .masthead {
    height: 58px;
  }
  .intro {
    display: none;
  }
  .journey-layout {
    margin-top: 18px;
  }
  .city-scene {
    height: max(120px, calc(100dvh - 200px - var(--completion-space, 0px)));
    min-height: 0;
  }
  .journal {
    padding: 0;
  }
  #complete-banner {
    padding: 8px 12px;
  }
  .journal .progress,
  .route-journal {
    display: none;
  }
  .toolbar {
    margin: 8px 0;
  }
  .map-topline,
  .map-bottomline {
    padding: 9px 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.atmosphere-4 .land-name,
[data-theme='dark'] .city-scene .land-name {
  fill: #e6efe9;
  stroke: #1d354a;
}
/* Harbour of lights (and every harbour in the dark theme): dusk-dark houses, lit windows,
   beacons and lamplight on every square. */
.atmosphere-4 .wall,
[data-theme='dark'] .city-scene .wall {
  fill: #a9a592;
}
.atmosphere-4 .wall-side,
[data-theme='dark'] .city-scene .wall-side {
  fill: #6f6b5d;
}
.atmosphere-4 .window,
[data-theme='dark'] .city-scene .window {
  fill: #ffd77d;
  filter: drop-shadow(0 0 3px #ffc65c);
}
.atmosphere-4 .door,
[data-theme='dark'] .city-scene .door {
  fill: #e8a955;
}
.atmosphere-4 .plaza-glow,
[data-theme='dark'] .city-scene .plaza-glow {
  opacity: 1;
}
.atmosphere-4 .street,
[data-theme='dark'] .city-scene .street {
  stroke: #c9c2a4;
}
.atmosphere-4 .street.walked,
[data-theme='dark'] .city-scene .street.walked {
  stroke: #ffd48a;
}
.atmosphere-4 .tree,
[data-theme='dark'] .city-scene .tree {
  fill: #35525a;
}
.atmosphere-4 .beacon,
[data-theme='dark'] .city-scene .beacon {
  fill: #ffd36b;
  filter: drop-shadow(0 0 6px #ffc65c);
}
.graph-view .plaza-glow,
[data-theme='dark'] .graph-view .plaza-glow {
  opacity: 0;
}
.atmosphere-4 .node-letter {
  fill: #486573;
}
.atmosphere-4 {
  --bridge-shadow-color: #101d30;
  --bridge-shadow-opacity: 0.4;
}
.atmosphere-4 .bridge-deck {
  filter: brightness(1.05);
}
.replay-scene {
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
}
.replay-scene svg {
  height: auto;
  max-height: 380px;
}
.replay-slider {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  margin: 20px 0;
}
.replay-slider input {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}
#mobile-level-title {
  display: none;
}
@media (max-width: 700px) {
  #chapter-label {
    display: none;
  }
  #mobile-level-title {
    display: block;
    font-size: 11px;
    letter-spacing: 0;
    max-width: 70%;
    line-height: 1.5;
  }
  main {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
@media (max-width: 380px) {
  /* The bridge mark stands in for the name on the narrowest phones; the link keeps its name. */
  #brand-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  h1 {
    font-size: 24px;
    line-height: 1.35;
  }
  .brand {
    font-size: 14px;
    letter-spacing: 0.5px;
  }
  .intro .eyebrow {
    font-size: 9px;
    letter-spacing: 1.5px;
  }
  .intro p:last-child {
    font-size: 11px;
  }
  .daily-link {
    min-width: 79px;
  }
  nav button {
    font-size: 10px;
    padding: 7px;
  }
  .journal h2 {
    font-size: 18px;
  }
}

.city-world {
  transform-origin: 50% 50%;
}
.journey-complete .city-world {
  transform: scale(0.97);
}
.reflections {
  opacity: 0.24;
  pointer-events: none;
}
.bridge.risk .bridge-rail {
  stroke: #a14f38;
  stroke-width: 28;
  stroke-dasharray: 9 5;
}
.pairing-diagram {
  background: var(--water);
  border-radius: 12px;
  overflow: hidden;
}
.pairing-diagram .city-scene {
  height: auto;
  max-height: 48dvh;
  min-height: 0;
}
.endpoint-pairings {
  pointer-events: none;
}
.endpoint-pair {
  animation: pair-arrival 400ms ease-out both;
  animation-delay: var(--pair-delay);
}
.endpoint-pair path {
  fill: none;
  stroke: #b87222;
  stroke-width: 7;
  stroke-linecap: round;
}
.paired-end {
  fill: #ffe2a8;
  stroke: #825420;
  stroke-width: 3;
}
.unpaired-end {
  fill: #fff4d7;
  stroke: #a3432f;
  stroke-width: 6;
  stroke-dasharray: 3 2;
  animation: pair-arrival 350ms ease-out 1900ms both;
}
.pairing-key {
  list-style: none;
  padding: 0;
  font-size: 12px;
  line-height: 1.8;
}
.pairing-key li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.pairing-key b {
  display: block;
  color: var(--gold-text);
}
@keyframes pair-arrival {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* The same engraved commission identity appears in the atlas, collection and result. */
.commission-stamp {
  display: inline-block;
  width: 54px;
  height: 54px;
  flex: none;
  fill: none;
  stroke: var(--gold-text);
  stroke-width: 1.4;
  vertical-align: middle;
}
.stamp-perforation {
  stroke-dasharray: 1 3;
}
.stamp-emblem {
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.level-card .commission-stamp {
  float: right;
  margin: 0 0 6px 8px;
}
.commission-card .commission-stamp {
  float: none;
  display: block;
  margin: 0 0 8px;
}
.completion-copy {
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}
#complete-banner button {
  flex: none;
}
@media (max-width: 380px) {
  #complete-banner {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
  }
  #complete-banner .completion-copy,
  #complete-banner button {
    grid-column: 1 / -1;
  }
  #complete-banner .commission-stamp + .completion-copy {
    grid-column: 2;
  }
  #complete-banner .commission-stamp {
    grid-row: 1;
    width: 38px;
    height: 38px;
  }
}
