:root {
  color-scheme: light;
  --paper: #f7f1e7;
  --surface: #fffaf2;
  --ink: #26221d;
  --muted: #766f66;
  --line: #e7dccd;
  --green: #4f7f64;
  --blue: #477aa8;
  --rose: #b65e68;
  --gold: #b9893f;
  --shadow: 0 12px 30px rgba(44, 34, 25, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 14px calc(28px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
}

.sync-pill {
  min-width: 58px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.86);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.hero-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 148px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.96), rgba(250, 239, 224, 0.9)),
    radial-gradient(circle at 85% 20%, rgba(79, 127, 100, 0.2), transparent 34%);
  box-shadow: var(--shadow);
}

.paper-tape {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 10px;
  background: #ead5a3;
  color: #5b4622;
  font-size: 12px;
}

.hero-card h2 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.12;
}

.hero-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-action,
.action-button,
.map-tool,
.tab,
.day-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.hero-action {
  min-width: 86px;
  height: 40px;
  border-radius: 8px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 12px;
}

.tab {
  height: 42px;
  border-radius: 8px;
}

.tab.active {
  border-color: #3e6f58;
  background: #3e6f58;
  color: #fff;
}

.day-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-button {
  flex: 0 0 104px;
  height: 62px;
  border-radius: 8px;
  padding: 8px;
  text-align: left;
}

.day-button strong,
.day-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.day-button.active {
  border-color: var(--rose);
  box-shadow: inset 0 0 0 1px var(--rose);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.map-panel,
.empty-state,
.edit-panel,
.place-card,
.segment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.map-panel {
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px;
}

.map-tool {
  height: 36px;
  border-radius: 8px;
  padding: 0 12px;
}

.map-canvas {
  width: 100%;
  height: 360px;
  background: #e4ece7;
}

.map-status {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.empty-state {
  padding: 20px;
  line-height: 1.6;
}

.action-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 12px;
}

.action-button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.field input {
  height: 40px;
  padding: 0 10px;
}

.field textarea {
  min-height: 84px;
  padding: 10px;
  resize: vertical;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
}

.section-head h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.weather-note {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  background: rgba(255, 250, 242, 0.72);
  color: #6d5b3d;
  font-size: 13px;
  line-height: 1.55;
}

.place-list {
  display: grid;
  gap: 10px;
}

.place-item {
  position: relative;
  overflow: hidden;
}

.delete-reveal {
  position: absolute;
  inset: 0 0 0 auto;
  width: 74px;
  border: 0;
  background: var(--rose);
  color: #fff;
}

.place-card {
  position: relative;
  min-height: 128px;
  padding: 12px;
  transition: transform 0.18s ease;
  touch-action: pan-y;
}

.place-item.swiped .place-card {
  transform: translateX(-74px);
}

.place-card.dragging {
  opacity: 0.9;
  box-shadow: var(--shadow);
}

.place-main {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding-right: 54px;
}

.time-pill {
  min-height: 34px;
  padding: 8px 6px;
  border-radius: 8px;
  background: #efe4d4;
  color: #5c4c37;
  font-size: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

.place-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.place-title-row h3 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.25;
}

.place-kind {
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf1ee;
  color: var(--green);
  font-size: 11px;
}

.place-address,
.place-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.card-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.tool-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.mini-add {
  flex: 0 0 38px;
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.action-row.three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.action-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.action-button.warn {
  border-color: #d4aaa1;
  color: #9a4a40;
}

.action-button.baidu {
  border-color: #bdd0df;
  color: #376b9c;
}

.inline-editor,
.edit-panel {
  margin-top: 12px;
  padding: 12px;
}

.edit-panel h2 {
  margin-bottom: 12px;
  font-size: 17px;
}

.status-text {
  margin: 10px 0 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.type-transfer {
  border-left: 5px solid var(--blue);
}

.type-stay {
  border-left: 5px solid #8d6aa8;
}

.type-visit {
  border-left: 5px solid var(--green);
}

.type-backup {
  border-left: 5px solid var(--rose);
}

.type-daily {
  border-left: 5px solid var(--gold);
}

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

.segment-card {
  padding: 12px;
}

.segment-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.segment-kicker {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.segment-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.install-action {
  width: 100%;
  margin-top: 10px;
}

.private-gate {
  min-height: 62vh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 14px;
  padding: 32px 2px;
}

.private-gate h2 {
  max-width: 520px;
  font-size: clamp(28px, 9vw, 42px);
  line-height: 1.05;
}

.private-gate p {
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.gate-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid #dcc7aa;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(247, 241, 231, 0.9)),
    #f7f1e7;
  box-shadow: 0 10px 26px rgba(72, 83, 74, 0.14);
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}

.drag-active {
  user-select: none;
}

.planner-marker {
  width: 30px;
  height: 34px;
  border: 2px solid #fff;
  border-radius: 16px 16px 16px 4px;
  background: var(--gold);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
  color: #fff;
  display: grid;
  place-items: center;
  transform: rotate(-45deg);
}

.planner-marker span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  transform: rotate(45deg);
}

.planner-marker.transfer {
  background: var(--blue);
}

.planner-marker.stay {
  background: #8d6aa8;
}

.planner-marker.visit {
  background: var(--green);
}

.planner-marker.backup {
  background: var(--rose);
}

@media (max-width: 390px) {
  .hero-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-action {
    width: 100%;
  }

  .place-main {
    grid-template-columns: 1fr;
    padding-right: 48px;
  }

  .action-row.three {
    grid-template-columns: 1fr;
  }
}
