:root {
  --ink: #17202a;
  --muted: #687386;
  --panel: #fbfcfd;
  --line: #d8dee8;
  --soft: #eef3f8;
  --blue: #246bfe;
  --green: #147d64;
  --gold: #9b6b05;
  --red: #b3404a;
  --shadow: 0 18px 40px rgba(24, 36, 58, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #e8edf2;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

button:hover {
  border-color: #aeb9c8;
  background: #f7fafc;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23526070' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 107, 254, 0.14);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(390px, 470px) minmax(0, 1fr);
  height: 100vh;
  min-height: 720px;
}

.planner-panel {
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-header,
.section-title,
.search-row,
.api-key-row,
.coord-row,
.compact-actions,
.stop-actions,
.mode-metrics,
.leg-heading,
.leg-choice {
  display: flex;
  align-items: center;
}

.panel-header,
.section-title,
.leg-heading {
  justify-content: space-between;
  gap: 12px;
}

.panel-header {
  justify-content: flex-start;
}

.panel-header > div:nth-child(2) {
  min-width: 0;
}

.header-route-actions {
  display: flex;
  margin-left: auto;
  gap: 6px;
}

.header-route-actions button {
  display: inline-grid;
  width: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  font-size: 20px;
  font-weight: 500;
}

.favorite-route-button.is-selected {
  color: #755700;
  border-color: #d1ad33;
  background: #ffed9b;
  box-shadow: 0 0 0 3px rgba(214, 169, 0, 0.14);
}

.favorites-toggle {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  min-height: 42px;
  place-items: center;
  padding: 0;
  color: #184cae;
  border-color: #bfd0ee;
  border-radius: 50%;
  background: linear-gradient(180deg, #f8fbff 0%, #e8f0ff 100%);
  box-shadow: 0 8px 18px rgba(36, 107, 254, 0.12);
}

.favorites-toggle:hover {
  color: #174fbf;
  border-color: #7fa2e8;
  background: #dfeaff;
}

.profile-avatar-text {
  font-size: 15px;
  font-weight: 800;
}

.favorites-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid var(--panel);
  border-radius: 999px;
  padding: 0 4px;
  color: #fff;
  background: var(--red);
  font-size: 10px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.logout-button {
  min-height: 34px;
  padding: 0 14px;
  color: #7c3b44;
  border-color: #e3c0c6;
  background: #fff6f7;
  font-size: 12px;
  font-weight: 700;
}

.logout-button:hover {
  border-color: #d78d99;
  background: #ffedef;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.15;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 23px;
  line-height: 1;
}

.search-row {
  position: relative;
  display: block;
}

.search-row input {
  padding-right: 46px;
}

.search-row button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-grid;
  width: 34px;
  min-height: 30px;
  place-items: center;
  padding: 0;
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.search-row button svg,
.map-locate-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.api-key-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.api-key-row {
  gap: 8px;
}

.api-key-row button {
  flex: 0 0 76px;
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-pill,
.google-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  color: #526070;
  background: #eef3f8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill[data-state="ready"],
.google-pill {
  color: #fff;
  background: var(--green);
}

.status-pill[data-state="loading"] {
  color: #17202a;
  background: #d9e7ff;
}

.status-pill[data-state="error"] {
  color: #fff;
  background: var(--red);
}

.coord-row {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 8px;
}

.coord-row label,
.settings-grid label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.coord-row input,
.settings-grid input,
.settings-grid select {
  margin-top: 5px;
}

.coord-row button {
  align-self: end;
  min-height: 38px;
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.settings-block,
.stops-block,
.legs-block {
  display: grid;
  gap: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.setting-input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
  margin-top: 5px;
}

.setting-input-action input {
  margin-top: 0;
}

.setting-input-action button {
  min-height: 38px;
  padding: 0;
  color: var(--blue);
  border-color: #b9c9e7;
  background: #eef4ff;
  font-size: 20px;
  font-weight: 800;
}

.setting-input-action button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.setting-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
}

.wide-setting {
  grid-column: 1 / -1;
}

.section-title select {
  max-width: 130px;
  background-position: right 11px center;
}

.clear-button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.clear-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.compact-actions {
  gap: 8px;
}

.compact-actions button {
  padding: 0 12px;
}

.stop-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stop-item {
  position: relative;
  display: grid;
  grid-template-columns: 16px 24px minmax(0, 1fr);
  gap: 3px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    opacity 140ms ease;
  cursor: grab;
}

.stop-item.is-map-focused {
  border-color: #7fa6e3;
  box-shadow: 0 0 0 3px rgba(36, 107, 254, 0.12);
}

.stop-item.is-dragging {
  opacity: 0.32;
  border-style: dashed;
  cursor: grabbing;
}

.stop-item.drag-before {
  border-color: var(--blue);
  box-shadow: inset 0 3px 0 var(--blue);
  transform: translateY(5px);
}

.stop-item.drag-after {
  border-color: var(--blue);
  box-shadow: inset 0 -3px 0 var(--blue);
  transform: translateY(-5px);
}

.drag-ghost {
  position: fixed;
  top: -1000px;
  left: -1000px;
  z-index: 9999;
  opacity: 0.72;
  pointer-events: none;
  transform: rotate(1deg) scale(0.98);
  border-color: rgba(36, 107, 254, 0.55);
  box-shadow: 0 14px 30px rgba(23, 32, 42, 0.24);
}

.stop-item.is-settling {
  animation: settle-stop 300ms ease-out;
}

@keyframes settle-stop {
  0% {
    opacity: 0.5;
    transform: translateY(-10px) scale(0.985);
  }
  65% {
    transform: translateY(2px) scale(1.005);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.drag-indicator {
  width: 16px;
  min-height: 28px;
  padding: 0;
  border: 0;
  color: #8a96a8;
  background: transparent;
  cursor: grab;
  font-size: 17px;
  line-height: 1;
  touch-action: none;
  margin-top: 3px;
}

.drag-indicator:hover {
  color: var(--blue);
  border: 0;
  background: transparent;
}

.stop-index {
  display: inline-grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 1px 4px rgba(23, 32, 42, 0.26);
  font-size: 12px;
  font-weight: 800;
  border: 0;
  padding: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  margin-top: 5px;
}

.stop-index:hover {
  color: #fff;
  border-color: #fff;
  background: #6f9bff;
}

.stop-index:active {
  cursor: grabbing;
}

.stop-fields {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.stop-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.stop-name {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-weight: 700;
  cursor: text;
}

.stop-address {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-attractions,
.stop-hotels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.attraction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #6d5000;
  background: rgba(255, 225, 92, 0.7);
  font-size: 10px;
  font-weight: 700;
}

.attraction-chip.is-user {
  color: #64358e;
  background: #f1e5ff;
}

.stop-hotels {
  margin-top: 1px;
}

.hotel-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #793944;
  border: 1px solid #dfbcc1;
  background: #fff2f3;
  font-size: 10px;
  font-weight: 700;
}

.attraction-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-attraction,
.remove-hotel {
  width: 17px;
  min-height: 17px;
  padding: 0;
  border: 0;
  color: currentColor;
  background: transparent;
  font-size: 14px;
  line-height: 1;
}

.remove-attraction:hover,
.remove-hotel:hover {
  border: 0;
  color: var(--red);
  background: transparent;
}

.stop-actions {
  position: static;
  flex: 0 0 auto;
  gap: 4px;
  opacity: 1;
  pointer-events: auto;
}

.stop-actions button {
  width: 30px;
  min-height: 30px;
  padding: 0;
}

.stop-actions .detail-stop {
  width: auto;
  padding: 0 7px;
  color: #725400;
  border-color: #e2c35e;
  background: #fff6c9;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.stop-actions .hotel-stop {
  width: auto;
  padding: 0 7px;
  color: #793944;
  border-color: #dfbcc1;
  background: #fff2f3;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.stop-actions .hotel-stop:hover {
  color: #652c35;
  border-color: #c98f98;
  background: #fbe2e5;
}

.stop-actions .detail-stop:hover {
  color: #5d4400;
  border-color: #caa637;
  background: #ffed9b;
}

.remove-stop {
  position: static;
  width: 30px !important;
  min-height: 30px !important;
  border-radius: 7px;
  padding: 0 !important;
  color: var(--red);
  background: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.remove-stop:hover {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.empty-state {
  padding: 18px;
  border: 1px dashed #aeb9c8;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}

.favorite-route-button {
  color: #725a20;
  border-color: #e5d8a8;
  background: #fffdf3;
  font-weight: 600;
}

.share-route-button {
  color: #315b9e;
  border-color: #c7d6ed;
  background: #f2f6fc;
  font-weight: 600;
}

.share-route-button:hover {
  color: #214a8c;
  border-color: #9eb9e3;
  background: #e5eefb;
}

.share-route-button:disabled {
  color: var(--muted);
  border-color: var(--line);
  background: #f5f7f9;
  cursor: default;
  opacity: 0.65;
}

.favorite-route-button:hover {
  color: #5f4915;
  border-color: #d1bd73;
  background: #fff7d9;
}

.favorite-route-button:disabled {
  color: var(--muted);
  border-color: var(--line);
  background: #f5f7f9;
  cursor: default;
  opacity: 0.65;
}

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

.favorites-backdrop {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(23, 32, 42, 0.34);
  backdrop-filter: blur(2px);
}

.favorites-backdrop[hidden] {
  display: none;
}

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 980;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 42, 0.52);
  backdrop-filter: blur(4px);
}

.auth-modal-backdrop[hidden] {
  display: none;
}

.auth-modal {
  display: grid;
  width: min(440px, 100%);
  gap: 18px;
  padding: 28px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
}

.auth-modal-header,
.auth-modal-actions,
.auth-methods,
.auth-email-actions {
  display: flex;
  align-items: center;
}

.auth-modal-header,
.auth-modal-actions {
  justify-content: space-between;
  gap: 10px;
}

.auth-modal-header h2 {
  font-size: 30px;
  line-height: 1.15;
}

.auth-modal-close {
  width: 40px;
  min-height: 40px;
  padding: 0;
  color: #7b8798;
  border-radius: 50%;
  background: #f7f9fc;
  font-size: 24px;
}

.auth-modal-close:hover {
  color: #516072;
  background: #eef3f8;
}

.auth-modal-hint {
  color: #6f7c90;
  font-size: 15px;
  line-height: 1.6;
}

.auth-google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  border-color: #d8e0ea;
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
}

.auth-google-button svg {
  width: 22px;
  height: 22px;
}

.auth-google-button:hover {
  background: #f8fafc;
}

.auth-divider {
  position: relative;
  text-align: center;
}

.auth-divider::before {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid #e3e8ef;
  content: "";
}

.auth-divider span {
  position: relative;
  z-index: 1;
  padding: 0 12px;
  color: #8a96a8;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.auth-email-panel {
  display: grid;
  gap: 12px;
}

.auth-email-title-row {
  display: grid;
  gap: 4px;
}

.auth-email-title-row strong {
  font-size: 14px;
}

.auth-email-title-row span {
  color: #8a96a8;
  font-size: 12px;
}

.auth-email-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
}

.auth-email-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.auth-email-actions .primary-share-button {
  width: auto;
  min-width: 0;
  padding: 0 18px;
  min-height: 48px;
  border-radius: 14px;
  font-size: 14px;
  white-space: nowrap;
}

.auth-secondary-button {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  color: #4e5d73;
  border-color: #d8e0ea;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
}

.auth-secondary-button:hover {
  background: #f8fafc;
}

.auth-methods {
  gap: 8px;
}

.auth-methods[hidden],
.auth-email-panel[hidden] {
  display: none !important;
}

.auth-method-button {
  min-width: 112px;
  padding: 8px 14px;
  color: #5f6d80;
  border-color: #cdd7e6;
  background: #f5f8fc;
  font-weight: 700;
}

.auth-method-button.is-active {
  color: #174fbf;
  border-color: #8eb0ef;
  background: #eaf2ff;
}

.auth-field {
  display: grid;
  gap: 0;
  color: #4e5d73;
  font-size: 12px;
  font-weight: 700;
}

.auth-field input {
  min-height: 52px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
}

.auth-email-inline input {
  margin-top: 0;
}

.auth-field input:disabled {
  color: #7b8798;
  background: #f7f9fc;
}

.auth-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  line-height: 1.4;
}

.auth-modal-actions button {
  width: 100%;
  min-height: 44px;
  color: #5f6d80;
  border-color: #d9e1eb;
  border-radius: 14px;
  background: #fff;
  font-weight: 700;
}

.favorites-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  display: flex;
  width: min(420px, calc(100vw - 28px));
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  box-shadow: 18px 0 42px rgba(23, 32, 42, 0.22);
  transform: translateX(-105%);
  transition: transform 220ms ease;
  visibility: hidden;
}

.favorites-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.favorites-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.profile-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.profile-card-main {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.profile-drawer-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  color: #184cae;
  background: #eaf2ff;
  font-size: 20px;
  font-weight: 800;
}

.profile-card-copy {
  min-width: 0;
}

.profile-card-copy strong,
.profile-card-copy span {
  display: block;
}

.profile-card-copy strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.profile-card-actions {
  display: flex;
  gap: 10px;
}

.profile-card-actions button {
  flex: 1 1 0;
}

.profile-primary-button {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
  font-weight: 700;
}

.profile-primary-button:hover {
  color: #fff;
  border-color: #1957d5;
  background: #1957d5;
}

.favorites-section {
  display: grid;
  gap: 12px;
}

.favorites-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.favorites-section-title span {
  font-size: 15px;
  font-weight: 800;
}

.favorites-section-title small {
  color: var(--muted);
  font-size: 11px;
}

.favorites-drawer-header h2 {
  font-size: 22px;
}

.favorites-close {
  display: inline-grid;
  width: 36px;
  min-height: 36px;
  place-items: center;
  padding: 0;
  color: var(--muted);
}

.favorites-close svg {
  width: 22px;
  height: 22px;
}

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

.favorite-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.favorite-item-copy {
  min-width: 0;
}

.favorite-item-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-item-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.favorite-item-actions {
  display: flex;
  gap: 6px;
}

.favorite-open {
  padding: 0 10px;
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.favorite-open:hover {
  color: #fff;
  border-color: #1957d5;
  background: #1957d5;
}

.favorite-delete {
  width: 34px;
  padding: 0;
  color: var(--red);
  font-size: 19px;
}

.favorite-delete:hover {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.favorites-empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.favorites-empty[hidden] {
  display: none;
}

.stop-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 970;
  background: rgba(23, 32, 42, 0.3);
  backdrop-filter: blur(2px);
}

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

.stop-detail-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1050;
  display: flex;
  width: min(440px, calc(100vw - 28px));
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  box-shadow: 18px 0 42px rgba(23, 32, 42, 0.22);
  transform: translateX(-105%);
  transition: transform 220ms ease;
  visibility: hidden;
}

.stop-detail-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.stop-detail-header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.stop-detail-back {
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--muted);
  font-size: 30px;
  line-height: 1;
}

.stop-detail-header h2 {
  overflow: hidden;
  font-size: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-detail-address {
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-detail-summary {
  display: grid;
  gap: 3px;
}

.stop-detail-summary strong {
  font-size: 15px;
}

.stop-detail-summary span,
.stop-detail-loading {
  color: var(--muted);
  font-size: 11px;
}

.attraction-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 7px;
}

.attraction-search-row button {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.stop-detail-loading {
  min-height: 42px;
  padding: 14px 18px;
  text-align: center;
}

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

.attraction-option {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attraction-option.is-selected {
  border-color: #e2c35e;
  background: rgba(255, 225, 92, 0.22);
}

.attraction-option.is-hotel.is-selected {
  border-color: #dfbcc1;
  background: #fff6f7;
}

.attraction-option.is-hotel .attraction-rank {
  background: #c98f98;
}

.attraction-option.is-hotel .attraction-check input:checked + span {
  border-color: #c98f98;
  background: #c98f98;
}

.attraction-rank {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #c79b00;
  font-size: 12px;
  font-weight: 800;
}

.attraction-option-copy {
  min-width: 0;
}

.attraction-option-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attraction-option-meta,
.attraction-option-address {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attraction-check {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  cursor: pointer;
}

.attraction-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attraction-check span {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 2px solid #c7d0dc;
  border-radius: 5px;
  background: #fff;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.attraction-check input:checked + span {
  border-color: #c79b00;
  background: #c79b00;
}

.attraction-check input:checked + span::after {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

.attraction-check input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(201, 102, 112, 0.2);
}

.share-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 42, 0.58);
  backdrop-filter: blur(4px);
}

.share-modal-backdrop[hidden] {
  display: none;
}

.share-modal {
  display: grid;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  gap: 14px;
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.share-modal-header,
.share-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.share-modal-header h2 {
  font-size: 21px;
}

.share-modal-close {
  width: 36px;
  padding: 0;
  color: var(--muted);
  font-size: 23px;
}

.share-preview {
  display: grid;
  max-height: min(68vh, 720px);
  overflow: auto;
  place-items: start center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8edf2;
}

.share-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.share-modal-actions button {
  flex: 1;
  font-weight: 800;
}

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

.primary-share-button:hover {
  color: #fff;
  border-color: #1957d5;
  background: #1957d5;
}

.summary-strip div {
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

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

.summary-strip strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  font-size: 18px;
}

#totalTime {
  overflow-wrap: normal;
  font-size: 15px;
  white-space: nowrap;
}

.leg-list {
  display: grid;
  gap: 12px;
}

.leg-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.leg-heading {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.leg-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
}

.leg-distance {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.mode-grid {
  display: grid;
}

.leg-choice {
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid #edf1f5;
}

.leg-choice:last-child {
  border-bottom: 0;
}

.route-details {
  padding: 11px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
}

.route-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.route-details-header strong {
  color: var(--ink);
  font-size: 13px;
}

.route-details-header a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.route-warnings {
  margin-top: 9px;
  padding: 8px 9px;
  border-left: 3px solid var(--gold);
  color: #6f5008;
  background: #fff7df;
  line-height: 1.45;
}

.route-step-list {
  display: grid;
  max-height: 220px;
  gap: 8px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 0 0 0 22px;
}

.route-step-list li {
  padding-left: 2px;
  line-height: 1.4;
}

.route-step-list span,
.route-step-list small {
  display: block;
}

.route-step-list span {
  color: var(--ink);
}

.route-step-list small {
  margin-top: 2px;
  color: var(--muted);
}

.mode-name {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 112px;
  font-weight: 800;
}

.mode-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.mode-metrics {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric-pill,
.recommend-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f3f6fa;
}

.recommend-pill {
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.map-area {
  position: relative;
  min-width: 0;
}

.map-legend {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 430;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-width: calc(100% - 120px);
  padding: 7px 9px;
  border: 1px solid rgba(23, 32, 42, 0.16);
  border-radius: 7px;
  color: #3f4a58;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 10px rgba(23, 32, 42, 0.14);
  backdrop-filter: blur(5px);
  font-size: 11px;
  font-weight: 700;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(23, 32, 42, 0.15);
}

.legend-dot.route {
  background: var(--blue);
}

.legend-dot.famous {
  background: rgba(214, 169, 0, 0.7);
}

.legend-dot.user {
  background: #8e44ad;
}

.legend-dot.hotel {
  background: #d9a5ad;
}

#map {
  width: 100%;
  height: 100%;
  background: #dbe5ed;
}

.map-locate-button {
  position: absolute;
  right: 18px;
  bottom: 34px;
  z-index: 440;
  display: inline-grid;
  width: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  color: #315b9e;
  border-color: rgba(23, 32, 42, 0.2);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 10px rgba(23, 32, 42, 0.2);
}

.map-locate-button:hover {
  color: #174fbf;
  border-color: #7fa2e8;
  background: #eef4ff;
}

.map-place-label {
  display: inline-flex !important;
  align-items: center !important;
  max-width: 180px;
  overflow: hidden !important;
  transform: translateY(-35px) !important;
  border: 1px solid #c99a00 !important;
  border-radius: 6px !important;
  padding: 5px 8px !important;
  color: #332700 !important;
  background-color: rgba(255, 214, 48, 0.95) !important;
  box-shadow: 0 3px 10px rgba(86, 66, 0, 0.3) !important;
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  -webkit-text-stroke: 0.25px rgba(255, 255, 255, 0.85);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75),
    0 0 2px rgba(255, 255, 255, 0.9);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-time-label {
  display: inline-flex !important;
  align-items: center !important;
  border: 1px solid rgba(23, 32, 42, 0.22) !important;
  border-radius: 999px !important;
  padding: 5px 9px !important;
  color: #111 !important;
  background-color: rgba(255, 255, 255, 0.88) !important;
  box-shadow: 0 3px 9px rgba(23, 32, 42, 0.24) !important;
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  -webkit-text-stroke: 0.2px rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}

.map-attraction-label {
  display: inline-flex !important;
  max-width: 150px;
  overflow: hidden !important;
  transform: translateY(-25px) !important;
  border: 1px solid #b88a00 !important;
  border-radius: 5px !important;
  padding: 3px 6px !important;
  color: #4f3900 !important;
  background: rgba(255, 225, 92, 0.7) !important;
  box-shadow: 0 2px 7px rgba(105, 76, 0, 0.3) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-attraction-label.is-user {
  color: #4b176e !important;
  border-color: #9c62c9 !important;
  background: rgba(232, 204, 255, 0.95) !important;
}

.map-attraction-label.is-hotel {
  color: #662d37 !important;
  border-color: #b9707b !important;
  background: rgba(243, 217, 221, 0.98) !important;
  box-shadow: 0 2px 7px rgba(105, 43, 54, 0.24) !important;
}

.map-add-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 42, 0.52);
  backdrop-filter: blur(3px);
}

.map-add-backdrop[hidden] {
  display: none;
}

.map-add-dialog {
  display: grid;
  width: min(430px, 100%);
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

.map-add-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-add-dialog header h2 {
  font-size: 21px;
}

.map-add-dialog header button {
  width: 36px;
  padding: 0;
  color: var(--muted);
  font-size: 23px;
}

.map-add-dialog label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.map-add-dialog label input {
  margin-top: 5px;
}

.map-add-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.map-add-options button {
  display: grid;
  min-height: 84px;
  gap: 5px;
  align-content: center;
  padding: 10px;
  text-align: left;
}

.map-add-options strong,
.map-add-options span {
  display: block;
}

.map-add-options strong {
  color: var(--ink);
  font-size: 14px;
}

.map-add-options span,
.map-add-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.map-add-options button:last-child {
  border-color: #d8b5ef;
  background: #fbf5ff;
}

.map-add-options button:disabled {
  opacity: 0.5;
  cursor: default;
}

.map-key-empty {
  position: absolute;
  inset: 0;
  z-index: 420;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--ink);
  text-align: center;
  background:
    linear-gradient(rgba(232, 237, 242, 0.9), rgba(232, 237, 242, 0.9)),
    repeating-linear-gradient(45deg, #d7e0e8 0 12px, #e4ebf1 12px 24px);
}

.map-key-empty[hidden] {
  display: none;
}

.map-key-empty strong {
  font-size: 21px;
}

.map-key-empty span {
  max-width: 390px;
  color: var(--muted);
  line-height: 1.5;
}

.map-toast {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 450;
  max-width: min(420px, calc(100% - 36px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 32, 42, 0.76);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.26s ease,
    transform 0.26s ease;
}

.map-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(470px, 54vh) minmax(520px, auto);
    height: auto;
    min-height: 100vh;
  }

  .map-area {
    grid-row: 1;
  }

  .planner-panel {
    grid-row: 2;
    overflow: visible;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .planner-panel {
    padding: 14px;
  }

  .panel-header {
    align-items: flex-start;
  }

  .favorites-toggle {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .favorites-drawer {
    padding: 16px;
  }

  .search-row,
  .api-key-row,
  .coord-row,
  .settings-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .coord-row button {
    width: 100%;
  }

  .wide-setting {
    grid-column: auto;
  }

  .stop-item {
    grid-template-columns: 16px 24px minmax(0, 1fr);
  }

  .stop-actions {
    position: static;
  }

  .leg-choice {
    align-items: flex-start;
    flex-direction: column;
  }

  .mode-metrics {
    justify-content: flex-start;
  }

  .route-details-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (hover: none) {
  .stop-actions {
    opacity: 1;
    pointer-events: auto;
  }
}
