:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-border: #d9e2ef;
  --text: #142033;
  --muted: #68758a;
  --blue: #2f7df0;
  --blue-dark: #1f62c8;
  --dark: #15191e;
  --dark-2: #101419;
  --green: #31bd61;
  --red: #ef4444;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(47, 125, 240, 0.08), transparent 32rem),
    var(--bg);
}

body.embed-mode .page {
  width: min(1228px, calc(100vw - 24px));
  margin: 16px auto 24px;
}

.page {
  width: min(1520px, calc(100vw - 48px));
  margin: 20px auto 42px;
}

h1 {
  margin: 0 0 18px;
  font-size: 32px;
  line-height: 1.25;
}

h2 {
  margin: 0;
  padding-left: 12px;
  border-left: 4px solid var(--blue);
  font-size: 17px;
  line-height: 1.2;
}

.layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 38px rgba(40, 63, 94, 0.08);
}

.sidebar {
  padding: 18px;
  display: grid;
  gap: 18px;
}

.picker {
  display: grid;
  gap: 10px;
}

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

select,
input,
button {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd8e8;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

select,
input {
  min-height: 38px;
  padding: 6px 10px;
}

select[size] {
  height: 148px;
}

option {
  padding: 4px 6px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.preview-block {
  display: grid;
  gap: 10px;
}

.preview-title {
  font-weight: 700;
  font-size: 14px;
}

.preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #101419;
  color: #95a3b8;
}

.preview .map-layer {
  --max-map-height: 190px;
}

.preview-content {
  width: 100%;
}

.monster-list {
  margin: 0 12px 12px;
  padding: 8px 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #d8e3f2;
  font-size: 13px;
  line-height: 1.55;
}

.preview .monster-list {
  margin: 8px 10px 10px;
  font-size: 12px;
}

.monster-title {
  margin-right: 6px;
  color: #8dbbff;
  font-weight: 800;
}

.monster-item {
  display: inline-block;
  margin-right: 10px;
  white-space: nowrap;
}

.monster-count {
  color: #ffd166;
  font-weight: 800;
}

.route-options {
  display: grid;
  gap: 10px;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 14px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #32425a;
}

.check-grid input[type="checkbox"] {
  width: auto;
  min-width: 14px;
  min-height: 14px;
  padding: 0;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button {
  min-height: 46px;
  cursor: pointer;
  font-weight: 700;
  background: #fff;
}

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

button:hover {
  border-color: var(--blue);
}

button.primary:hover {
  background: var(--blue-dark);
}

.route-panel {
  padding: 18px;
  min-width: 0;
}

.summary {
  margin-top: 12px;
  padding: 13px 16px;
  border: 1px solid #cfdbec;
  border-radius: 7px;
  background: #f7faff;
}

.summary-trail {
  margin-top: 6px;
  color: #31527d;
  font-size: 14px;
  line-height: 1.5;
}

.route {
  margin-top: 12px;
  display: grid;
  gap: 14px;
}

.unreachable {
  padding: 26px 18px;
  border: 1px solid #cfdbec;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.step-card {
  overflow: hidden;
  border-radius: 7px;
  background: var(--dark);
  color: #f4f7fb;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.14);
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px 8px;
  font-size: 17px;
  font-weight: 800;
}

.step-method {
  color: #58a6ff;
  font-weight: 800;
  text-align: right;
}

.step-note {
  margin: 0 12px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, 0.44);
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
}

.map-stage {
  position: relative;
  margin: 0 12px 12px;
  min-height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--dark-2);
}

.map-wrap {
  position: relative;
  max-width: 100%;
  display: flex;
  justify-content: center;
}

.map-layer {
  --max-map-height: 430px;
  position: relative;
  width: min(100%, var(--map-w), calc(var(--max-map-height) * var(--map-ratio)));
  aspect-ratio: var(--map-ratio);
  flex: 0 1 auto;
}

.map-layer img {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8);
  z-index: 5;
}

.marker::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 4px;
  height: 24px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55);
}

.marker::after {
  content: attr(data-label);
  position: absolute;
  left: 10px;
  top: -25px;
  max-width: 140px;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  color: currentColor;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.marker.current {
  color: var(--green);
}

.marker.next {
  color: var(--red);
}

.npc-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border: 1px solid #191919;
  border-radius: 50%;
  background: #ffd43b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.82);
  z-index: 2;
}

.npc-name {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff3a3;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 2;
}

.route-line {
  position: absolute;
  left: var(--left);
  top: var(--top);
  width: var(--width);
  height: 3px;
  transform-origin: 0 50%;
  transform: rotate(var(--angle));
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72);
  z-index: 4;
}

.route-line.warp {
  background: rgba(67, 150, 255, 0.76);
}

.route-line.climb,
.route-line.rope,
.route-line.ladder {
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    rgba(168, 85, 247, 0.94) 0 10px,
    rgba(232, 121, 249, 0.88) 10px 16px
  );
}

.route-line.fall,
.route-line.jump {
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    rgba(250, 204, 21, 0.9) 0 12px,
    rgba(250, 204, 21, 0.2) 12px 21px
  );
}

.route-line.portal {
  background: rgba(45, 212, 191, 0.82);
}

.route-point {
  display: none;
  position: absolute;
  left: var(--left);
  top: var(--top);
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(239, 68, 68, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.72);
  z-index: 2;
}

.route-point.warp {
  border-color: rgba(67, 150, 255, 0.9);
}

.route-point.climb,
.route-point.rope,
.route-point.ladder {
  border-color: rgba(168, 85, 247, 0.94);
}

.route-point.fall,
.route-point.jump {
  border-color: rgba(250, 204, 21, 0.94);
}

.route-point.portal {
  border-color: rgba(45, 212, 191, 0.94);
}

.dream-room-note,
.dream-room-label {
  position: absolute;
  z-index: 3;
  color: #f41522;
  font-weight: 900;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 2px rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.dream-room-note {
  left: 50%;
  top: 8%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  white-space: nowrap;
}

.dream-room-label {
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  font-size: 64px;
  line-height: 1;
}

.preview .dream-room-note {
  font-size: 12px;
}

.preview .dream-room-label {
  font-size: 32px;
}

.empty-map {
  padding: 72px 16px;
  color: #a8b3c4;
  text-align: center;
}

@media (max-width: 980px) {
  .page {
    width: min(100vw - 24px, 760px);
    margin-top: 18px;
  }

  .layout {
    grid-template-columns: 1fr;
  }
}
