@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@500;700&family=Ma+Shan+Zheng&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --paper: #f7f1e4;
  --paper-warm: #efe4d0;
  --paper-inked: #fcf8ee;
  --graphite: #2f2d2a;
  --graphite-soft: #5f5952;
  --graphite-line: #948a78;
  --wash-sage: #dbe8dc;
  --wash-amber: #f2dcc0;
  --stamp: #91563e;
  --stamp-soft: #f4dfce;
  --danger: #964b47;
  --radius: 16px;
  --shadow-soft: 0 8px 18px rgba(47, 45, 42, 0.14);
  --shadow-pencil: 0 2px 0 rgba(47, 45, 42, 0.28);
  --scribble: rgba(82, 71, 55, 0.28);
  --font-title: "Ma Shan Zheng", "Caveat", "Noto Sans SC", cursive;
  --font-body: "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--graphite);
  font-family: var(--font-body);
  line-height: 1.45;
  background:
    radial-gradient(circle at 14% 8%, rgba(242, 220, 192, 0.48), transparent 33%),
    radial-gradient(circle at 92% 0%, rgba(219, 232, 220, 0.52), transparent 31%),
    var(--paper);
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul,
ol {
  margin: 8px 0 0;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 82% 86%, rgba(145, 86, 62, 0.1), transparent 30%),
    radial-gradient(circle at 18% 90%, rgba(95, 89, 82, 0.08), transparent 34%);
}

.page {
  width: min(1040px, calc(100vw - 24px));
  margin: 16px auto 24px;
  display: grid;
  gap: 14px;
}

.panel {
  position: relative;
  border: 1.4px solid var(--graphite-line);
  border-radius: var(--radius);
  background:
    linear-gradient(170deg, rgba(255, 251, 243, 0.97), rgba(247, 239, 225, 0.93)),
    var(--paper);
  box-shadow: var(--shadow-soft);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(126, 116, 98, 0.26);
  border-radius: calc(var(--radius) - 5px);
  pointer-events: none;
}

.hero {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  background:
    linear-gradient(120deg, rgba(242, 220, 192, 0.3), transparent 58%),
    linear-gradient(330deg, rgba(219, 232, 220, 0.4), transparent 60%),
    var(--paper-inked);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 64px;
  height: 18px;
  background: rgba(224, 205, 170, 0.68);
  border: 1px solid rgba(145, 129, 101, 0.28);
  border-radius: 3px;
  pointer-events: none;
}

.hero::before {
  left: 24px;
  transform: rotate(-7deg);
}

.hero::after {
  right: 28px;
  transform: rotate(9deg);
}

.eyebrow {
  font-size: 12px;
  color: var(--graphite-soft);
  letter-spacing: 0.04em;
}

.hero h1 {
  margin-top: 5px;
  font-family: var(--font-title);
  font-size: clamp(1.55rem, 2.3vw, 2.08rem);
  line-height: 1.2;
  color: #282521;
}

.subtitle {
  margin-top: 8px;
  max-width: 68ch;
  font-size: 13px;
  color: #3e3a34;
}

.toolbar {
  display: grid;
  justify-items: end;
}

.control {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #443f37;
}

.control select {
  border: 1.3px solid #90846f;
  border-radius: 10px;
  padding: 7px 10px;
  min-width: 118px;
  font: inherit;
  color: #2f2d2a;
  background:
    linear-gradient(180deg, #fffaf0, #f1e6d2),
    var(--paper-inked);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.control select:focus-visible {
  outline: 2px solid rgba(145, 86, 62, 0.42);
  outline-offset: 2px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.layout.has-map-sidebar {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
}

.layout .panel {
  padding: 15px 15px 16px;
}

.layout h2 {
  font-family: var(--font-title);
  font-size: clamp(1.2rem, 2vw, 1.52rem);
  color: #2d2924;
}

.helper {
  margin-top: 4px;
  font-size: 12px;
  color: #5b5449;
}

.map-sidebar {
  position: sticky;
  top: 10px;
  align-self: start;
  height: calc(100vh - 20px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
}

.map-sidebar.is-collapsed {
  display: none;
}

.map-sidebar__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.map-sidebar__close {
  border: 0;
  background: transparent;
  color: #756857;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.2;
  padding: 0;
  border-bottom: 1px dotted rgba(117, 104, 87, 0.82);
  text-transform: uppercase;
  cursor: pointer;
}

.map-sidebar__close:hover {
  color: #3a3027;
  border-bottom-color: rgba(58, 48, 39, 0.82);
}

.map-sidebar__close:focus-visible {
  outline: 2px solid rgba(145, 86, 62, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

.map-sidebar__meta {
  margin: 0;
  font-size: 12px;
  color: #51483d;
}

.map-sidebar__canvas {
  border: 1px dashed #9b8f7b;
  border-radius: 10px;
  overflow: hidden;
  min-height: 280px;
  background: rgba(255, 250, 240, 0.75);
}

.map-sidebar__notice {
  margin: 0;
  font-size: 11.5px;
  color: #5c5449;
}

.map-backdrop {
  display: none;
}

.day-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.day-card {
  position: relative;
  border: 1.2px solid #9d927f;
  border-radius: 13px;
  padding: 11px;
  background:
    linear-gradient(165deg, rgba(255, 251, 242, 0.96), rgba(244, 235, 218, 0.94));
  box-shadow: var(--shadow-pencil);
  overflow: hidden;
}

.day-card::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 18px;
  width: 46px;
  height: 15px;
  background: rgba(225, 212, 189, 0.76);
  border: 1px solid rgba(137, 123, 97, 0.26);
  border-radius: 2px;
  transform: rotate(8deg);
}

.day-card::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed var(--scribble);
  border-radius: 10px;
  pointer-events: none;
}

.day-card__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.day-card__identity {
  min-width: 0;
}

.day-card__title {
  font-family: var(--font-title);
  font-size: 1.22rem;
  color: #2c2924;
  letter-spacing: 0.01em;
}

.day-card__meta {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #575045;
}

.day-card__meta-dot {
  color: #7a6f5f;
}

.day-card__meta-label {
  font-weight: 600;
  color: #464036;
}

.day-card__route-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.day-card__meta-route {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  color: #4d463c;
  min-width: 0;
  font-style: italic;
}

.route-arrow {
  color: #8b7c67;
  font-size: 11px;
}

.day-card__toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 2px;
}

.route-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font: inherit;
  border: 1.2px solid #8f7f68;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8ed, #efe0c8);
  color: #342a21;
  text-decoration: none;
  font-size: 11.5px;
  line-height: 1.25;
  padding: 4px 9px;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.route-link:hover {
  transform: translateY(-1px);
  border-color: #74614d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.route-link:focus-visible {
  outline: 2px solid rgba(145, 86, 62, 0.42);
  outline-offset: 2px;
}

.route-link--icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  justify-content: center;
  padding: 0;
}

.route-link__icon {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.day-card__expanded {
  margin-top: 10px;
  border-top: 1px dashed #9f957f;
  padding-top: 10px;
  position: relative;
}

.day-card__expanded::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 2px;
  width: 92px;
  border-top: 2px solid rgba(76, 70, 59, 0.6);
  transform: rotate(-1.3deg);
}

.detail__block {
  margin-top: 8px;
}

.detail__block h3 {
  display: inline-block;
  font-size: 12px;
  color: #443f37;
  background: rgba(242, 220, 192, 0.45);
  border-radius: 8px;
  padding: 2px 7px;
}

.detail__block li,
.detail__block p {
  font-size: 13px;
  color: #39352f;
}

.step-list {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
  counter-reset: trip-step;
  display: grid;
  gap: 6px;
}

.step-item {
  margin: 0;
  counter-increment: trip-step;
}

.step-main {
  color: #332f29;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.step-title {
  min-width: 0;
  flex: 1 1 auto;
}

.step-main::before {
  content: counter(trip-step);
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(95, 83, 65, 0.45);
  color: #574835;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
  margin-top: 1px;
  background: rgba(244, 232, 213, 0.72);
}

.step-dot {
  color: #70665a;
  padding: 0 4px;
}

.step-entity__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 3px;
  border: 1px solid #8e7860;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8ed, #efe0c8);
  color: #3c2f23;
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  padding: 2px 9px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.step-entity__chip:hover {
  transform: translateY(-1px);
  border-color: #78624c;
}

.step-entity__chip:focus-visible {
  outline: 2px solid rgba(145, 86, 62, 0.42);
  outline-offset: 2px;
}

.step-entity__chip--fallback {
  cursor: default;
  border-style: dashed;
  color: #5f564a;
  font-style: italic;
}

.location-profile-card {
  margin-top: 6px;
  border: 1px dashed #9e907a;
  border-radius: 10px;
  padding: 8px;
  background: linear-gradient(170deg, rgba(255, 251, 242, 0.96), rgba(244, 234, 217, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.day-location-panel {
  margin-top: 10px;
  border: 1px dashed #9f927d;
  border-radius: 10px;
  background: linear-gradient(170deg, rgba(255, 251, 243, 0.94), rgba(244, 234, 218, 0.92));
  padding: 8px;
}

.day-location-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.day-location-panel__head h4 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 1.04rem;
  color: #2d2924;
}

.day-location-panel__close {
  border: 0;
  background: transparent;
  color: #756857;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.2;
  padding: 0;
  border-bottom: 1px dotted rgba(117, 104, 87, 0.82);
  text-transform: uppercase;
  cursor: pointer;
}

.day-location-panel__close:hover {
  color: #3a3027;
  border-bottom-color: rgba(58, 48, 39, 0.82);
}

.day-location-panel__close:focus-visible {
  outline: 2px solid rgba(145, 86, 62, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

.location-profile-card__header {
  display: flex;
  justify-content: flex-end;
}

.location-profile-card__type {
  display: inline-flex;
  border: 1px solid #886048;
  border-radius: 999px;
  background: #f0d8c0;
  color: #5c3928;
  font-size: 10.5px;
  line-height: 1.2;
  padding: 2px 8px;
}

.location-profile-card__line {
  margin-top: 5px;
  display: grid;
  gap: 3px;
}

.location-profile-card__label {
  font-size: 11px;
  color: #62584d;
  font-weight: 600;
}

.location-profile-card__value-link {
  color: #2f2c27;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  word-break: break-word;
}

.location-profile-card__quick-link {
  color: #4d4338;
  font-size: 11px;
  text-decoration: none;
}

.location-profile-card__quick-link:hover,
.location-profile-card__value-link:hover {
  color: #2d2018;
}

.location-profile-card__tips {
  margin-top: 7px;
}

.location-profile-card__tips-heading {
  font-size: 11px;
  color: #574f43;
  font-weight: 600;
}

.location-profile-card__tips ul {
  margin-top: 4px;
  padding-left: 18px;
}

.location-profile-card__tips li {
  font-size: 12px;
  color: #3e3832;
}

.notice,
.empty,
.unavailable {
  margin-top: 8px;
  border: 1px dashed #a79d88;
  border-radius: 11px;
  background: linear-gradient(160deg, #fff9ef, #f0e6d3);
  padding: 11px;
  font-size: 12.5px;
  color: #5a5348;
}

.error-banner {
  margin: 0;
  border: 1px solid #c7908a;
  color: var(--danger);
  background: #faecea;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .toolbar {
    justify-items: start;
  }

  .day-card__head {
    grid-template-columns: 1fr;
  }

  .day-card__toggle {
    justify-content: flex-start;
  }

  .day-card::before {
    right: auto;
    left: 18px;
    transform: rotate(-7deg);
  }

  .layout.has-map-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .map-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    top: auto;
    align-self: auto;
    height: min(78vh, 620px);
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    margin: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    grid-template-rows: auto auto minmax(220px, 1fr) auto;
    overflow: hidden;
    box-shadow: 0 -10px 34px rgba(38, 30, 22, 0.28);
  }

  .map-sidebar__notice {
    max-height: 76px;
    overflow-y: auto;
  }

  body.map-sheet-open {
    overflow: hidden;
  }

  .map-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(26, 21, 15, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .map-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  .map-sidebar__canvas {
    min-height: 240px;
  }
}

@media (max-width: 580px) {
  .page {
    width: calc(100vw - 14px);
    margin-top: 8px;
    gap: 10px;
  }

  .hero,
  .layout .panel {
    padding: 12px;
  }

  .day-card {
    padding: 10px;
  }

  .day-card__title {
    font-size: 1.12rem;
  }

  .day-card__meta {
    gap: 4px;
  }

  .day-card__meta-dot {
    display: none;
  }

  .step-entity__chip {
    max-width: 100%;
  }

}
