/* The composer and receipt share the map without changing its dimensions. */
.island-layout,
.island-layout.has-receipt {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.planner-map-composer {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: max(clamp(32px, 9dvh, 90px), env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(620px, calc(100% - 48px));
  margin: 0;
  padding: 11px 13px 7px;
  border: 1px solid #858585;
  border-image: var(--journal-panel-frame) 24 / 16px / 4px stretch;
  border-radius: 12px;
  background: #fffffff5;
  color: #242424;
  box-shadow: 0 5px 20px #21382c20;
  font-family: var(--journal-font, "Microsoft YaHei", sans-serif);
}
.planner-map-composer:focus-within { border-image-source: var(--journal-ink-frame); }
.planner-map-input-row { display: flex; align-items: center; gap: 10px; }
#planner-map-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 96px;
  margin: 0;
  padding: 9px 3px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: 400 18px/26px var(--journal-font, "Microsoft YaHei", sans-serif);
  resize: none;
  touch-action: auto;
}
#planner-map-input::placeholder { color: #666; opacity: 1; }
#planner-map-send {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: #303030;
  color: white;
  cursor: pointer;
  touch-action: manipulation;
}
#planner-map-send:hover { background: #151515; }
.planner-map-tools { display: flex; align-items: center; gap: 13px; }
.planner-map-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 2px 1px;
  border: 0;
  background: transparent;
  color: #565656;
  font: 400 14px/22px var(--journal-font, "Microsoft YaHei", sans-serif);
  cursor: pointer;
  touch-action: manipulation;
}
.planner-map-tools button:hover { color: #111; }
.planner-map-composer :is(button, textarea):focus-visible {
  outline: 2px solid #303030;
  outline-offset: 3px;
}
#planner-map-message { margin: 4px 0; color: #5e442c; font-size: 14px; line-height: 1.4; }

.island-layout #planner-results {
  position: absolute;
  z-index: 6;
  inset: max(76px, calc(env(safe-area-inset-top) + 56px)) max(20px, env(safe-area-inset-right)) auto auto;
  width: clamp(320px, 28vw, 390px);
  height: min(540px, 64dvh);
  max-width: calc(100% - 28px);
  padding: 8px 7px 0;
  border: 1px solid #858585;
  border-image: var(--journal-panel-frame) 24 / 16px / 4px stretch;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 26px #21382c29;
}
#planner-records {
  position: absolute;
  inset: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) auto auto;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 28px);
  font-family: var(--journal-font, "Microsoft YaHei", sans-serif);
}
#planner-records[hidden] { display: none; }
.island-layout #planner-show-receipt {
  position: static;
  min-height: 44px;
  max-width: 100%;
  padding: 7px 14px;
  white-space: nowrap;
  font: 600 16px/24px var(--journal-font, "Microsoft YaHei", sans-serif);
}
#planner-record-list {
  width: min(360px, calc(100vw - 28px));
  max-height: min(340px, 48dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid #858585;
  border-image: var(--journal-panel-frame) 24 / 16px / 4px stretch;
  border-radius: 9px;
  background: white;
  box-shadow: 0 7px 24px #21382c29;
}
#planner-record-list li + li { border-top: 1px solid #e2e2e2; }
#planner-record-list button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 9px 12px;
  border: 0;
  border-radius: 5px;
  background: white;
  color: #242424;
  font: 400 16px/24px var(--journal-font, "Microsoft YaHei", sans-serif);
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}
#planner-record-list button:hover,
#planner-record-list button[aria-current] { background: #f0f2ec; }
#planner-record-list small { color: #666; font-size: 13px; }
#planner-record-list button:focus-visible { outline: 2px solid #303030; outline-offset: -2px; }
.island-layout #planner-results .receipt-feed { padding-inline: 5px; }

@media (max-width: 720px) {
  .island-layout,
  .island-layout.has-receipt { grid-template-rows: minmax(0, 1fr); }
  .planner-map-composer {
    width: calc(100% - 28px);
    bottom: max(clamp(24px, 8dvh, 65px), env(safe-area-inset-bottom));
    padding: 8px 10px 4px;
  }
  #planner-map-input { font-size: 16px; }
  .planner-map-tools { gap: 15px; }
  .planner-map-tools button { min-height: 38px; }
  .island-layout #planner-results {
    top: max(66px, calc(env(safe-area-inset-top) + 54px));
    right: max(12px, env(safe-area-inset-right));
    width: min(330px, calc(100% - 24px));
    height: min(390px, 47dvh);
    max-width: none;
  }
  #planner-records {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: auto;
    bottom: auto;
  }
}

@media (max-height: 500px) {
  .planner-map-composer { bottom: max(12px, env(safe-area-inset-bottom)); }
  .island-layout #planner-results { height: 46dvh; }
}

.island-layout.is-map-keyboard-open .planner-map-composer {
  bottom: calc(var(--planner-keyboard-inset) + 12px);
}
.island-layout.is-map-keyboard-open #planner-results {
  height: max(100px, calc(var(--planner-visible-height) - 274px));
}
