:root {
  --ink: #241f1a;
  --muted: #5c5348;
  --paper: #f6f1e6;
  --page: #ebe3d4;
  --line: rgba(36, 31, 26, 0.12);
  --sea-top: #d7ebe4;
  --sea-bottom: #b5d5cc;
  --shadow: 0 18px 50px rgba(70, 48, 24, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, #f8f3e8, transparent 55%),
    var(--page);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.7;
}

button, a { font: inherit; color: inherit; }

button { cursor: pointer; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.22em;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: "KaiTi", "STKaiti", "楷体", "Songti SC", serif;
  font-size: clamp(40px, 6vw, 68px);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
}

.top-side {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.top-side p {
  margin: 0;
  color: var(--muted);
}

#plan-toggle,
.plan-exit,
.day-add,
.stop-add,
.stop-del {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #241f1a;
  color: #f6f1e6;
}

.plan-exit,
.stop-del {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  padding: 0;
}

.plan-title {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: "KaiTi", "STKaiti", "楷体", serif;
  font-size: 34px;
  color: var(--ink);
}

.day-row {
  display: flex;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 8px;
}

.day-chip {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 6px 14px rgba(36, 31, 26, 0.12);
  color: #fff;
  font-weight: 700;
}

.day-chip.is-on { outline: 3px solid #241f1a; }

.slot {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 3px solid var(--day, #8a5a2b);
}

.slot h3 { margin: 0 0 8px; font-size: 16px; }

.stop {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.stop img, .stop .ph {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  background: #e7e0d2;
}

.stop strong { display: block; }
.stop p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.plan-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.plan-form input, .plan-form select, .plan-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}

.plan-hint { color: var(--muted); font-size: 13px; }

.mode-row, .legs a, .inbox { margin-top: 8px; }
.mode-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-row button, #share, #extract-apply, #copy-local, #opt-yes {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
}
.mode-row button.is-on { background: #241f1a; color: #f6f1e6; }
.legs p { margin: 6px 0; font-size: 13px; color: var(--muted); }
.inbox { padding: 10px; background: #fff7e8; border-radius: 12px; }
.inbox-item { display: block; margin: 6px 0; background: none; border: 0; text-decoration: underline; }
.opt-preview { margin: 10px 0; padding: 10px; border-radius: 12px; background: #fff; }
#extract-list label { display: block; margin: 4px 0; }
#plan-date, #stay-name { width: 100%; margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font: inherit; }

body.is-planning { background: #d7e4df; }
body.is-planning .page {
  width: min(1180px, calc(100% - 28px));
  height: calc(100dvh - 20px);
  margin: 10px auto;
  padding: 0;
}
body.is-planning .top { display: none; }
body.is-planning .stage {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 440px);
  gap: 14px;
  height: 100%;
  align-items: stretch;
}
body.is-planning .map-card {
  height: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 28px;
}
body.is-planning .map-note,
body.is-planning .keys,
body.is-planning #back { display: none; }
body.is-planning .map-frame,
body.is-planning .map-frame svg { height: 100%; border-radius: 28px; }
body.is-planning .detail {
  position: relative;
  top: auto;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 8px 16px 22px;
  border-radius: 28px;
  background: #f7f3ec;
}
body.is-planning .plan-title { font-size: 28px; line-height: 1.15; padding: 0; }
body.is-planning #live {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  height: auto;
  margin: 0;
  padding: 10px 16px;
  overflow: visible;
  clip: auto;
  border-radius: 999px;
  background: #241f1a;
  color: #f6f1e6;
  z-index: 6;
  font-size: 14px;
}
body.is-planning #live:empty { display: none; }

#plan-tip {
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: calc(100% - 28px);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(36, 31, 26, 0.86);
  color: #f6f1e6;
  font-size: 13px;
}

.pi-grab {
  width: 42px;
  height: 4px;
  margin: 4px auto 10px;
  border-radius: 999px;
  background: #e4dbcf;
}
.pi-head { display: flex; gap: 10px; align-items: flex-start; }
.pi-head > div { flex: 1; min-width: 0; }
.pi-back, .pi-ghost, .pi-primary, .pi-seg button, .pi-tab, .pi-chips button, .pi-nudge button, .pi-staycard > button {
  border: 0;
  font: inherit;
  cursor: pointer;
}
.pi-back, .pi-ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 0;
  white-space: nowrap;
}
.pi-primary, #opt-yes, #extract-apply, #copy-local {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: #241f1a;
  color: #f6f1e6;
}
.pi-meta { margin: 0; color: var(--muted); font-size: 13px; }
.pi-date {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}
.pi-date input, .pi-staycard input, .pi-panel input, .pi-panel textarea, .pi-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  font: inherit;
}
.pi-date input { width: auto; }
.pi-days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 10px;
}
.pi-tab {
  display: grid;
  gap: 2px;
  min-width: 78px;
  padding: 8px 12px;
  border-radius: 16px;
  background: #fff;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(36, 31, 26, 0.06);
}
.pi-tab b { font-size: 14px; }
.pi-tab small { color: var(--muted); font-size: 12px; }
.pi-tab.is-on { background: var(--c, #241f1a); color: #fff; }
.pi-tab.is-on small { color: rgba(255, 255, 255, 0.8); }
.pi-addday { place-items: center; color: var(--muted); }
.pi-summary h2 {
  margin: 6px 0 4px;
  font-family: "KaiTi", "STKaiti", "楷体", serif;
  font-size: 32px;
  font-weight: 400;
}
.pi-summary p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.pi-seg { display: flex; gap: 8px; margin-bottom: 10px; }
.pi-seg button {
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
}
.pi-seg button.is-on, #optimize { background: #241f1a; color: #f6f1e6; }
.pi-staycard {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 18px;
  background: #fff;
}
.pi-staycard.is-on { box-shadow: inset 0 0 0 2px #241f1a; }
.pi-staycard > button {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #241f1a;
  color: #fff;
  font-weight: 700;
}
.pi-staycard input { margin: 0; }
.pi-card {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: 12px;
  align-items: center;
  margin: 8px 0;
  padding: 8px;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
}
.pi-shot { position: relative; width: 86px; height: 86px; }
.pi-shot img, .pi-fallback, .pi-hero img, .pi-hero span {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  background: #e7e0d2;
}
.pi-fallback, .pi-hero span {
  display: grid;
  place-items: center;
  color: #fff;
  background: #8a5a2b;
  font-size: 28px;
}
.pi-shot b {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
}
.pi-copy strong { display: block; font-size: 16px; }
.pi-copy p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.pi-nudge { display: grid; gap: 4px; }
.pi-nudge button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f3efe6;
}
.pi-leg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 0 28px;
  color: #7a7168;
  font-size: 12px;
}
.pi-leg::before {
  content: "";
  width: 2px;
  height: 18px;
  margin-right: 4px;
  background: repeating-linear-gradient(#d9d0c3, #d9d0c3 3px, transparent 3px, transparent 6px);
}
.pi-leg a {
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
}
.pi-empty {
  margin: 8px 0 12px;
  padding: 16px;
  border-radius: 20px;
  background: #fff;
}
.pi-empty strong { display: block; margin-bottom: 4px; }
.pi-empty p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.pi-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pi-chips button, .pi-suggest button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #f3efe6;
}
.pi-foot { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.pi-panel { display: grid; gap: 10px; margin-top: 8px; }
.pi-panel h2 {
  margin: 0;
  font-family: "KaiTi", "STKaiti", "楷体", serif;
  font-size: 32px;
  font-weight: 400;
}
.pi-suggest { display: grid; gap: 6px; }
.pi-hit {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
}
.pi-hit img, .pi-hit span {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  background: #e7e0d2;
}
.pi-file { color: var(--muted); font-size: 13px; }
.pi-file input { margin-left: 8px; }
.pi-hero { height: 180px; border-radius: 20px; overflow: hidden; }
.pi-hero img, .pi-hero span { border-radius: 0; }
.pi-move-day { display: flex; gap: 8px; align-items: center; }
.pi-move-day select { width: auto; }
.opt-preview { margin: 10px 0; padding: 12px; border-radius: 16px; background: #fff; }
.inbox { margin-top: 10px; padding: 12px; background: #fff7e8; border-radius: 16px; }
.inbox-item { display: block; margin: 6px 0; background: none; border: 0; text-decoration: underline; }
#extract-list label { display: block; margin: 4px 0; }

@media (max-width: 860px) {
  body.is-planning .page { width: 100%; height: 100dvh; margin: 0; }
  body.is-planning .stage { display: block; position: relative; }
  body.is-planning .map-card {
    position: absolute;
    inset: 0 0 42%;
    border-radius: 0;
  }
  body.is-planning .map-frame,
  body.is-planning .map-frame svg { border-radius: 0; }
  body.is-planning .detail {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 50%;
    height: auto;
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -16px 40px rgba(36, 31, 26, 0.16);
  }
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 22px;
  align-items: start;
}

.map-card, .detail {
  background: var(--paper);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.map-card { padding: 14px 14px 16px; }

.map-frame {
  background:
    radial-gradient(ellipse at 72% 18%, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(180deg, var(--sea-top), var(--sea-bottom));
  border-radius: 22px;
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

.region { cursor: pointer; }

.land {
  fill: var(--tone, #c8b89a);
  stroke: #f7f3ea;
  stroke-width: 2.4px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: filter 160ms ease, stroke 160ms ease;
}

.region:hover .land,
.region:focus-visible .land { filter: brightness(1.07) saturate(1.05); }

.region.is-selected .land {
  stroke: #9c2f1a;
  stroke-width: 4.5px;
  filter: brightness(1.08);
}

.region:focus { outline: none; }

.region-label, .inset-caption, .sea-label {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  pointer-events: none;
  user-select: none;
}

.region-label, .inset-caption {
  fill: #241f1a;
  font-size: 14px;
  font-weight: 700;
  text-anchor: middle;
  stroke: rgba(247, 243, 234, 0.94);
  stroke-width: 4px;
  paint-order: stroke fill;
}

.inset-caption { font-size: 13px; stroke-width: 0; fill: #241f1a; }

.sea-label {
  fill: rgba(36, 70, 64, 0.45);
  font-size: 13px;
  letter-spacing: 0.18em;
}

.inset-plate {
  fill: rgba(255, 255, 255, 0.38);
  stroke: rgba(36, 31, 26, 0.18);
  stroke-width: 1.4;
}

.region.is-selected .inset-plate { stroke: #241f1a; }

.map-note, .keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.map-note {
  margin: 12px 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.keys { margin-top: 12px; }

.keys button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: #fffdf8;
  border-radius: 999px;
  padding: 6px 11px 6px 9px;
  color: var(--ink);
}

.keys i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tone);
}

.keys button.is-selected { border-color: var(--ink); background: #fff; }

.detail {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 28px 28px 32px;
}

.detail h2, .sheet h3, .welcome h2 {
  font-family: "KaiTi", "STKaiti", "楷体", "Songti SC", serif;
  font-weight: 400;
}

.kana {
  margin: 0;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-size: 13px;
}

.sheet h2, .welcome h2 {
  margin: 4px 0 10px;
  font-size: 42px;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.lead { margin: 0 0 14px; font-size: 17px; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.facts li {
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}

.facts span {
  color: var(--muted);
  margin-right: 6px;
}

.cities { margin: 0 0 16px; color: var(--muted); }

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: -28px;
  background: var(--paper);
  z-index: 1;
}

.jump a {
  text-decoration: none;
  color: var(--muted);
}

.jump a:hover { color: var(--ink); }

.sheet section { padding-top: 8px; }

.sheet h3 {
  margin: 12px 0;
  font-size: 28px;
  letter-spacing: 0.08em;
}

.sheet h3::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--tone);
  transform: translateY(-1px);
}

.entries { list-style: none; margin: 0; padding: 0; }

.entry {
  margin: 0 0 12px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--tone);
}

.entry h3 {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.entry h3::before { content: none; }

.entry p, .sheet section > p { margin: 4px 0 0; color: #3f3831; }

.sheet ol { margin: 0; padding-left: 1.2em; }

.sheet ol li { margin: 8px 0; padding-left: 4px; }

.fine {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.text-btn, .welcome {
  background: none;
}

.text-btn {
  border: 0;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.welcome h2 { font-size: 36px; }

.welcome ol { margin: 12px 0 0; padding-left: 1.2em; color: var(--muted); }

.places {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.places span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .top, .stage { display: block; }
  .top-side { max-width: none; margin-top: 12px; }
  .detail {
    position: static;
    max-height: none;
    margin-top: 18px;
  }
  .jump { top: 0; }
}

.map-frame { position: relative; }

#back {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: #fffdf8;
  box-shadow: 0 6px 16px rgba(36, 31, 26, 0.12);
}

#back[hidden] { display: none; }

.pref-label, .area-label {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  text-anchor: middle;
  fill: #241f1a;
  stroke: rgba(247, 243, 234, 0.92);
  stroke-width: 3px;
  paint-order: stroke fill;
  pointer-events: none;
}

.pref-label { font-size: var(--pref-label, 8px); opacity: 0; }
.area-label { font-size: var(--area-label, 15px); }
.map-frame.is-zoomed .pref-label { opacity: 1; }
.map-frame.is-zoomed .area-label { opacity: 0; }

.shot {
  margin: 0 0 14px;
  border-radius: 18px;
  overflow: hidden;
  background: #e7e0d2;
}

.shot img {
  display: block;
  width: 100%;
  height: 210px;
  object-fit: cover;
}

.shot figcaption {
  margin: 0;
  padding: 6px 10px 8px;
  color: var(--muted);
  font-size: 12px;
}

.shot figcaption a { color: inherit; }

.outlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.outlinks a {
  text-decoration: none;
  border-radius: 999px;
  padding: 6px 12px;
  background: #241f1a;
  color: #f6f1e6;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .land { transition: none; }
}
