:root {
  color-scheme: light;
  --bg: #eef7f4;
  --ink: #10231f;
  --muted: #64756f;
  --panel: #ffffff;
  --line: #d8e6e1;
  --teal: #0f766e;
  --coral: #c58a2c;
  --gold: #b7791f;
  --blue: #2563eb;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

button {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr;
}

.top-nav {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: rgba(255, 255, 255, .84);
  border: 1px solid rgba(216, 230, 225, .82);
  border-radius: 8px;
  backdrop-filter: blur(16px);
  z-index: 8;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: white;
  background: var(--teal);
  font-size: 24px;
  line-height: 1;
}

.main {
  position: relative;
  min-height: 0;
}

.map-panel {
  position: absolute;
  inset: 0;
}

.map-toolbar {
  position: absolute;
  top: calc(58px + env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  z-index: 3;
}

.pill, .locate-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(15, 35, 31, .12);
}

.pill.active {
  background: var(--teal);
  color: #fff;
}

.locate-button {
  color: var(--teal);
  font-weight: 700;
}

.map-stage {
  height: 100%;
  overflow: hidden;
  background: #cbe9eb;
}

#travelMap {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.leaflet-container {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.number-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--teal);
  color: var(--teal);
  box-shadow: 0 5px 16px rgba(15, 35, 31, .28);
  font-weight: 800;
}

.number-marker.active {
  background: var(--teal);
  color: #fff;
  border-color: #fff;
}

.number-marker span {
  transform: translateY(-1px);
}

.map-label {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(15, 35, 31, .16);
  font-weight: 700;
}


.zoom-controls {
  position: absolute;
  right: 12px;
  bottom: 245px;
  display: grid;
  gap: 8px;
  z-index: 4;
}

.zoom-controls button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  color: var(--ink);
  font-size: 24px;
  box-shadow: 0 8px 20px rgba(15, 35, 31, .14);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 190px;
  padding: 6px 10px 72px;
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -18px 35px rgba(15, 35, 31, .14);
  overflow: auto;
  z-index: 4;
}

.sheet.expanded {
  height: min(68dvh, 620px);
}

.sheet.behind-detail {
  display: none;
}

.drag-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: #cbd8d4;
}

.day-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 64px;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.day-button {
  min-height: 42px;
  border-radius: 8px;
  background: #edf6f3;
  color: var(--ink);
  font-weight: 700;
}

.day-button.active {
  background: var(--teal);
  color: #fff;
}

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

.summary-grid div {
  padding: 7px;
  background: #f4faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-list {
  display: grid;
  gap: 8px;
}

.stop-card {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stop-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.stop-card h3 {
  margin: 0 0 2px;
  font-size: 15px;
  letter-spacing: 0;
}

.stop-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.stop-card button {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--teal);
  background: #e8f5f2;
  font-weight: 700;
}

.nav-item {
  height: 38px;
  flex: 1 1 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.nav-item.active {
  color: var(--teal);
  background: #e7f4f1;
}

.trip-editor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, .92);
}

.trip-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.trip-editor-head h3 {
  margin: 0 0 3px;
  font-size: 16px;
}

.trip-editor-head p,
.trip-save-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.trip-editor-head button,
.trip-editor-actions button {
  height: 36px;
  border-radius: 8px;
  padding: 0 12px;
  background: #eef5f2;
  color: var(--teal);
  font-weight: 700;
}

.trip-json-editor {
  width: 100%;
  height: min(46dvh, 420px);
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: 12px/1.45 Consolas, "SFMono-Regular", monospace;
  color: var(--ink);
  background: #fbfdfc;
  outline: none;
}

.trip-json-editor:focus {
  border-color: rgba(8, 119, 105, .55);
  box-shadow: 0 0 0 3px rgba(8, 119, 105, .12);
}

.trip-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 8px;
  margin-top: 8px;
}

.trip-editor-actions button:last-child {
  background: var(--teal);
  color: #fff;
}

.trip-save-status {
  min-height: 18px;
  margin-top: 7px;
}

.trip-save-status.error {
  color: #b42318;
}

.detail-panel {
  position: fixed;
  inset: auto 10px calc(8px + env(safe-area-inset-bottom)) 10px;
  width: calc(100vw - 20px);
  max-width: 520px;
  border: 0;
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, .18),
    rgba(255, 255, 255, .56)
  );
  border: 0;
  backdrop-filter: none;
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 70px rgba(15, 35, 31, .28);
  margin: 0 auto;
  z-index: 7;
}

.detail-panel[hidden] {
  display: none;
}

.detail-panel h2 {
  margin: 0 34px 4px 0;
  font-size: 19px;
}

.detail-panel p {
  color: var(--muted);
  line-height: 1.42;
  margin: 6px 0;
  font-size: 14px;
}

#detailMeta {
  display: inline-block;
  max-width: calc(100% - 4px);
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(44, 64, 59, .78);
  font-weight: 700;
}

#detailNote {
  display: inline-block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(45, 64, 59, .78);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #edf6f3;
  color: var(--ink);
  font-size: 22px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.dialog-actions button {
  height: 38px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.dialog-actions button + button {
  background: #eef5f2;
  color: var(--teal);
}

.dialog-actions button:first-child {
  background: #c58a2c;
  color: #fff;
}

.dialog-actions button:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.street-view-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 35, 31, .28);
  z-index: 20;
}

.street-view-header {
  height: calc(44px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: env(safe-area-inset-top) 10px 0 12px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
}

.street-view-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.street-view-header button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #edf6f3;
  color: var(--ink);
  font-size: 22px;
}

.street-view-status {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(54px + env(safe-area-inset-top));
  z-index: 2;
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, .9);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(15, 35, 31, .12);
}

.street-view-status[hidden] {
  display: none;
}

#streetViewCanvas {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: calc(44px + env(safe-area-inset-top));
  width: 100%;
  height: auto;
  min-height: 320px;
  background: #e5e3df;
}

@media (min-width: 820px) {
  .app-shell {
    max-width: 980px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .sheet {
    left: 18px;
    right: auto;
    bottom: 18px;
    width: 390px;
    height: calc(100% - 96px);
    border-radius: 8px;
    padding-bottom: 18px;
  }

  .zoom-controls {
    bottom: 88px;
  }

  .detail-panel {
    inset: auto 24px 24px auto;
    width: min(420px, calc(100vw - 40px));
  }

}
