:root {
  --bg: #120c09;
  --paper: #1a1410;
  --ink: #f6eee4;
  --muted: #c4b39a;
  --gold: #d4a35a;
  --line: rgba(212, 163, 90, .28);
  --red: #c23a2b;
  --orange: #e08932;
  --gray: #8a8076;
  --ok: #7dcc9f;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --run-h: 48px;
  --dock-h: 58px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #070504; color: var(--ink); }
body {
  font-family: "Manrope", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, a { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); text-decoration: none; }

.rail { display: none; }
.shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.spine { display: none; }

.run {
  position: absolute; left: 0; right: 0; top: 0; z-index: 30;
  height: calc(var(--safe-top) + var(--run-h));
  padding: var(--safe-top) 8px 6px;
  display: flex; align-items: center; gap: 6px;
  background: var(--bg);
}
.run-mid {
  flex: 1; min-width: 0; border: 0; background: transparent;
  text-align: left; padding: 0 4px 2px;
}
.run-kicker {
  display: block; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
}
.run-mid b {
  display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.run-page {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; padding-bottom: 4px;
}
.navbtn {
  width: 36px; height: 36px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(18, 12, 9, .7);
  font-size: 22px; line-height: 1; color: var(--gold);
}

.book {
  position: absolute;
  left: 0; right: 0;
  top: calc(var(--safe-top) + var(--run-h));
  bottom: calc(var(--safe-bottom) + var(--dock-h) + 16px);
  padding: 0;
}
.page {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 16px 20px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  animation: pageIn .38s cubic-bezier(.22, .8, .28, 1);
}
.page.flip-left { animation-name: pageLeft; }
.page.flip-right { animation-name: pageRight; }
@keyframes pageIn { from { opacity: .35; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes pageLeft { from { opacity: .35; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes pageRight { from { opacity: .35; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

.dock {
  position: absolute;
  left: 10px; right: 10px;
  bottom: calc(8px + var(--safe-bottom));
  z-index: 30;
  display: flex; gap: 2px; padding: 4px;
  border-radius: 22px;
  background: rgba(16, 11, 8, .96);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.dock a {
  flex: 1; min-width: 0; text-align: center; color: var(--muted);
  font-size: 10px; font-weight: 600; padding: 10px 1px; border-radius: 16px;
}
.dock a.on { color: var(--gold); background: rgba(212, 163, 90, .12); }

.cover {
  position: relative;
  margin: -10px -16px 14px;
  min-height: 62vh;
  border-radius: 0 0 28px 28px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  background: #1a100c;
}
.cover-photo, .chapter-photo, .day-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.cover-veil, .chapter-veil, .day-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,8,6,.12) 0%, rgba(12,8,6,.28) 42%, rgba(12,8,6,.94) 100%);
}
.cover-ink, .chapter-ink, .day-ink { position: relative; z-index: 1; padding: 28px 22px 22px; width: 100%; }
.issue {
  color: var(--gold); letter-spacing: .18em; font-size: 10px; font-weight: 700;
}
.cover h1 {
  margin: 10px 0 4px; font-size: 64px; line-height: .82; font-weight: 800; letter-spacing: -.04em;
  text-shadow: 0 8px 40px rgba(0,0,0,.55);
}
.cover .year { color: var(--gold); font-size: 22px; font-weight: 700; letter-spacing: .12em; }
.cover p { color: #f0e4d4; line-height: 1.4; margin: 8px 0 0; font-size: 14px; max-width: 28em; }
.chain { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chain span {
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; font-size: 11px; color: var(--muted);
}
.city-mosaic {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 4px 0 18px;
}
.city-tile {
  position: relative; height: 92px; border-radius: 16px; overflow: hidden; color: #fff;
}
.city-tile img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(1.05); }
.city-tile span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 8px;
  background: linear-gradient(transparent, rgba(10,6,4,.88));
  font-size: 12px; font-weight: 700; line-height: 1.15;
}
.city-tile small { display: block; font-weight: 500; opacity: .8; font-size: 10px; }

.eyebrow {
  color: var(--gold); letter-spacing: .16em; font-size: 10px; text-transform: uppercase; margin: 4px 0 6px;
}
h2 { font-size: 28px; line-height: 1.05; margin: 0 0 8px; font-weight: 800; }
h3 { font-size: 15px; margin: 18px 0 8px; letter-spacing: .04em; }
.lede, .meta, .toc a small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.folio { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: .16em; margin: 22px 0 8px; }

.toc { display: grid; gap: 0; margin-top: 8px; }
.toc a, .jump {
  display: grid; grid-template-columns: 36px 1fr; gap: 8px; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--line); color: inherit;
}
.toc a.toc-city {
  grid-template-columns: 56px 36px 1fr; align-items: center;
}
.toc-shot {
  width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: #2a2118;
}
.toc-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.toc .n { color: var(--gold); font-weight: 800; font-size: 13px; }
.toc b { font-size: 16px; font-weight: 700; }

.card, .stop, .place {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 12px;
  margin: 0 0 10px;
}
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 10px; font-weight: 700; margin: 0 4px 6px 0;
}
.chip.must { background: #3a1512; color: #ffb4a8; }
.chip.extra { background: #1c2430; color: #c5d4e6; }
.chip.booked { background: #123322; color: var(--ok); }
.chip.open { background: #3a2610; color: #ffc48a; }
.ok { color: var(--ok); }
.warn { color: var(--orange); }

.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; font-size: 12px; color: var(--muted); }
.live-map, .schematic {
  width: 100%; height: 280px; border-radius: 18px; border: 1px solid var(--line); background: #241910;
}
.live-map { height: 42vh; min-height: 240px; margin-bottom: 10px; }
.schematic { position: relative; overflow: hidden; }
.schematic svg { width: 100%; height: 100%; display: block; }
.offline {
  display: none; margin: 8px 0; padding: 8px 10px; border-radius: 12px;
  background: #2a2118; color: var(--gold); font-size: 12px;
}
.offline.show { display: block; }

.stop, .place {
  padding: 0; overflow: hidden;
}
.stop-body { padding: 12px; }
.place { padding: 0 0 12px; }
.place .chip, .place h3, .place .meta, .place .zh, .place .coords, .place .copy, .place .didi, .place p {
  margin-left: 12px; margin-right: 12px;
}
.place .chip { margin-top: 10px; }
.shot {
  width: 100%; height: 168px; border-radius: 18px 18px 0 0; overflow: hidden; background: #2a2118; cursor: zoom-in;
}
.shot img, .hero {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.shot:hover img, .place:hover .hero { transform: scale(1.08); }
.hero {
  width: 100%; height: 200px; border-radius: 18px 18px 0 0; margin-bottom: 8px; cursor: zoom-in; object-fit: cover;
}
.stop b, .place h3 { display: block; font-size: 15px; margin: 0 0 2px; }
.zh { font-size: 14px; color: var(--gold); }
.coords {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; color: var(--gold); word-break: break-all; margin-top: 6px;
}
.copy {
  display: inline-block; margin-top: 6px; border: 1px solid var(--line); background: transparent;
  border-radius: 10px; padding: 6px 10px; font-size: 11px; color: var(--gold);
}
.didi { font-size: 12px; background: #241910; border-radius: 10px; padding: 8px; margin-top: 6px; }

.subnav, .row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.subnav a, .subnav button, .row button {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent;
  border-radius: 999px; padding: 8px 12px; font-size: 12px; color: var(--muted);
}
.row button { flex: 1 1 30%; min-width: 88px; }
.subnav a.on, .subnav button.on, .row button.on { background: #2a2118; color: var(--gold); }

.chapter, .day-hero {
  position: relative;
  min-height: 42vh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0; margin: -10px -16px 16px; border-radius: 0 0 24px 24px;
  overflow: hidden; background: #1a100c;
}
.chapter .lede, .cover .lede { color: #f0e4d4; }
.chapter .zh-lg {
  font-size: 42px; line-height: 1; color: var(--gold); opacity: .9; font-weight: 700;
}
.nested a {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit;
}

.plan-group { margin-bottom: 8px; }
.plan-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: start;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px;
}
.plan-row small { color: var(--muted); }

.dayhead .num { font-size: 42px; font-weight: 800; letter-spacing: -.04em; }
.timeline { margin: 8px 0 14px; }
.tl {
  display: grid; grid-template-columns: 64px 1fr; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.tl b { font-size: 11px; color: var(--gold); }

.task-form, .check-item { margin-top: 10px; }
.task-form { display: grid; gap: 8px; }
.task-form input, .task-form select, .check-item select {
  width: 100%; min-width: 0; max-width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #120e0b;
}
.task-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; }
.task-form button {
  border: 0; border-radius: 12px; padding: 12px; background: var(--gold); color: #1a1208; font-weight: 800;
}
.check-item {
  display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px;
  padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper);
  overflow: hidden;
}
.check-item b { overflow-wrap: anywhere; }
.check-item.done { opacity: .48; }
.prio { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.prio.high { background: var(--red); }
.prio.mid { background: var(--orange); }
.prio.low { background: var(--gray); }

.lightbox {
  display: none; position: absolute; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .86); align-items: center; justify-content: center; padding: 24px;
}
.lightbox.on { display: flex; }
.lightbox img { max-width: 100%; max-height: 72%; border-radius: 16px; }

.stop, .place { cursor: pointer; }
.open-hint { color: var(--gold); font-size: 12px; margin-top: 8px; }
.sheet {
  display: none; position: absolute; inset: 0; z-index: 55;
  background: rgba(6, 4, 3, .72);
  padding: calc(var(--safe-top) + 8px) 12px calc(var(--safe-bottom) + 16px);
  align-items: stretch; justify-content: center;
}
.sheet.on { display: flex; }
.sheet-panel {
  position: relative;
  width: min(640px, 100%);
  margin: 0 auto;
  background: #16110d;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.sheet-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 40px; height: 40px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(18,12,9,.82);
  color: var(--gold); font-size: 22px; line-height: 1;
}
#place-sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-hero {
  width: 100%; height: 220px; object-fit: cover; display: block; cursor: zoom-in;
}
.sheet-inner { padding: 12px 16px 28px; }
.sheet-inner h2 { font-size: 26px; margin: 6px 0 4px; }
.sheet-inner h3 {
  margin: 16px 0 6px; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--gold);
}
.sheet-inner p { margin: 0 0 8px; color: #f0e4d4; font-size: 14px; line-height: 1.5; }

.city-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid #fff; vertical-align: -1px; }
.leaflet-control-attribution { font-size: 10px !important; background: rgba(18,12,9,.7) !important; color: #cbb9a0 !important; }
.leaflet-control-attribution a { color: #d4a35a !important; }
.mode-pin span {
  display: grid; place-items: center; width: 28px; height: 28px;
  background: #1c1612; border: 1px solid var(--gold); border-radius: 50%;
  font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.4);
}

.ghost {
  border: 1px solid var(--line); background: transparent; border-radius: 12px;
  padding: 8px 10px; color: var(--gold); font-size: 12px;
}

.rail-brand {
  display: block; color: var(--gold); letter-spacing: .18em; font-size: 10px; font-weight: 700;
  margin: 0 0 16px;
}
.rail a {
  display: block; color: var(--muted); padding: 7px 10px; border-radius: 10px; font-size: 13px;
}
.rail a.on { color: var(--ink); background: rgba(212, 163, 90, .12); }
.rail .grp { margin: 16px 0 6px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.rail .sub { padding-left: 16px; font-size: 12px; }
.stops-grid, .places-grid, .cards-grid, .checks-grid, .plan-spread { display: grid; gap: 10px; }

@media (min-width: 900px) {
  :root {
    --safe-top: 0px;
    --safe-bottom: 0px;
  }
  html, body { background: #0b0806; }
  .shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr);
  }
  .spine { display: none; }
  .dock { display: none; }
  .rail {
    display: block;
    grid-column: 1;
    grid-row: 1 / span 2;
    overflow-y: auto;
    padding: 22px 14px 40px;
    border-right: 1px solid var(--line);
    background: #100c09;
  }
  .run {
    position: relative;
    grid-column: 2;
    grid-row: 1;
    height: 64px;
    align-items: center;
    padding: 0 20px;
    background: #140e0a;
    border-bottom: 1px solid var(--line);
  }
  .run-mid b { font-size: 16px; }
  .run-kicker { font-size: 10px; }
  .navbtn { width: 42px; height: 42px; }
  .book {
    position: relative;
    grid-column: 2;
    grid-row: 2;
    inset: auto;
    padding: 0;
    min-height: 0;
  }
  .page {
    padding: 28px 48px 56px;
    max-width: 1120px;
    margin: 0 auto;
  }
  .cover {
    display: flex;
    align-items: flex-end;
    min-height: min(72vh, 680px);
    margin: -28px -48px 22px;
    width: calc(100% + 96px);
    border-radius: 0 0 28px 28px;
    padding: 0;
  }
  .cover-ink { padding: 48px 40px 36px; }
  .cover h1 { font-size: 108px; }
  .cover p { font-size: 18px; max-width: 36em; }
  .chapter, .day-hero {
    min-height: 46vh;
    margin: -8px -48px 22px;
    width: calc(100% + 96px);
    border-radius: 24px;
  }
  .city-mosaic { grid-template-columns: repeat(6, 1fr); }
  .city-tile { height: 140px; }
  .toc {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
  }
  .live-map, .schematic { height: min(58vh, 620px); min-height: 360px; }
  .hero { height: 240px; }
  .stop { display: flex; flex-direction: column; }
  .shot { width: 100%; height: 210px; }
  .stops-grid, .places-grid, .cards-grid, .plan-spread {
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
  }
  .checks-grid { grid-template-columns: 1fr 1fr; }
  .task-form { max-width: 560px; }
  .lightbox { position: fixed; }
  .sheet { position: fixed; padding: 40px 24px; }
  .sheet-hero { height: 280px; }
  .sheet-panel { max-height: min(88vh, 900px); }
  .folio { margin-top: 36px; }
}

@media (min-width: 1400px) {
  .page { max-width: 1280px; }
  .places-grid { grid-template-columns: 1fr 1fr 1fr; }
}
