:root {
    --ink: #172033;
    --muted: #687386;
    --surface: #ffffff;
    --surface-soft: #f3f6fa;
    --border: #dbe2ea;
    --shadow: 0 12px 36px rgba(24, 34, 50, 0.09);
    --a: #2563eb;
    --b: #16a34a;
    --c: #ea580c;
    --d: #7c3aed;
    --must: #dc2626;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: #eef2f6;
}

button,
select,
input {
    font: inherit;
}

button,
select {
    min-height: 42px;
}

button {
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
}

button:hover {
    border-color: #9ca9ba;
    background: #f8fafc;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.page-shell {
    width: min(1540px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 8px;
    font-size: clamp(25px, 3vw, 38px);
    font-weight: 650;
    letter-spacing: -0.02em;
}

h2 {
    margin-bottom: 8px;
    font-size: 18px;
}

.subheading {
    max-width: 820px;
    margin-bottom: 0;
    color: var(--muted);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.header-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #15803d;
    border-radius: 10px;
    color: #ffffff;
    background: #15803d;
    text-decoration: none;
}

.header-link:hover {
    border-color: #166534;
    background: #166534;
}

.control-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.plan-selector {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.plan-selector legend {
    float: left;
    margin-right: 4px;
    color: var(--muted);
    font-size: 13px;
}

.plan-choice,
.compare-control {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
}

.plan-choice:has(input:checked) {
    color: #fff;
}

.plan-a:has(input:checked) {
    border-color: var(--a);
    background: var(--a);
}

.plan-b:has(input:checked) {
    border-color: var(--b);
    background: var(--b);
}

.plan-c:has(input:checked) {
    border-color: var(--c);
    background: var(--c);
}

.plan-d:has(input:checked) {
    border-color: var(--d);
    background: var(--d);
}

.plan-choice input,
.compare-control input {
    margin: 0;
}

.select-control {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.select-control select {
    padding: 0 34px 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--ink);
    background: var(--surface);
}

.node-filter {
    position: relative;
}

.node-filter summary {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
}

.node-filter-options {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    min-width: 190px;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.node-filter-options label {
    display: flex;
    align-items: center;
    min-height: 30px;
    gap: 9px;
}

.runtime-status {
    margin: 12px 2px;
    color: var(--muted);
    font-size: 13px;
}

.runtime-status.is-ready {
    color: #19703a;
}

.runtime-status.is-warning {
    color: #9a5b00;
}

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

.map-stage {
    position: relative;
    min-height: 680px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #e6ebf0;
    box-shadow: var(--shadow);
}

.amap-canvas,
.static-fallback {
    position: absolute;
    inset: 0;
}

.amap-canvas {
    z-index: 2;
}

.static-fallback {
    z-index: 1;
    display: grid;
    place-items: center;
    background: #f5f3ee;
}

.static-fallback img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fallback-message {
    position: absolute;
    left: 16px;
    bottom: 58px;
    display: grid;
    max-width: min(440px, calc(100% - 32px));
    gap: 3px;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    color: #fff;
    background: rgba(21, 31, 46, 0.78);
    backdrop-filter: blur(8px);
}

.fallback-message span {
    font-size: 13px;
}

.map-legend {
    position: absolute;
    z-index: 1000;
    left: 14px;
    bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    max-width: calc(100% - 28px);
    gap: 8px 14px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 10px;
    color: #1f2937;
    background: rgba(255, 255, 255, 0.91);
    box-shadow: 0 5px 16px rgba(20, 30, 45, 0.12);
    font-size: 12px;
    pointer-events: none;
}

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

.legend-line {
    width: 24px;
    height: 4px;
    border-radius: 99px;
}

.line-a {
    background: var(--a);
}

.line-b {
    background: var(--b);
}

.line-c {
    background: var(--c);
}

.line-d {
    background: var(--d);
}

.legend-marker {
    width: 13px;
    height: 13px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #64748b;
}

.marker-must {
    border-radius: 50%;
    background: var(--must);
}

.marker-hotel {
    border-radius: 3px;
    background: #4b5563;
}

.marker-waypoint {
    transform: rotate(45deg);
    background: #d97706;
}

.marker-optional {
    border-style: dashed;
    border-radius: 50%;
    background: #7c3aed;
}

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

.detail-column {
    display: grid;
    gap: 14px;
}

.summary-panel,
.navigation-panel,
.selection-panel,
.itinerary-panel {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

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

.navigation-guide {
    padding: 12px;
    border: 1px solid var(--border);
    border-left: 4px solid #d97706;
    border-radius: 10px;
    background: #fffbeb;
}

.navigation-guide.is-optional {
    border-left-color: var(--d);
    background: #faf5ff;
}

.navigation-guide-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.navigation-guide-heading span,
.navigation-guide-heading em {
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
}

.navigation-guide-heading em {
    padding: 3px 6px;
    border: 1px solid rgba(104, 115, 134, 0.25);
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.66);
}

.navigation-guide-heading strong {
    font-size: 13px;
}

.navigation-sequence {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.navigation-point,
.navigation-landmarks button {
    min-height: 34px;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12px;
    text-align: left;
}

.navigation-point span {
    display: inline-grid;
    width: 20px;
    height: 20px;
    margin-right: 5px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #b45309;
    font-size: 10px;
    font-weight: 700;
}

.is-optional .navigation-point span {
    background: var(--d);
}

.navigation-arrow {
    color: var(--muted);
    font-size: 12px;
}

.navigation-guide p,
.navigation-landmarks,
.navigation-warnings {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.navigation-guide p {
    margin: 6px 0 0;
}

.navigation-reason {
    color: #82500a !important;
}

.navigation-guide.is-optional .navigation-reason {
    color: #6b21a8 !important;
}

.navigation-landmarks button {
    min-height: 30px;
    margin: 2px;
    padding: 3px 6px;
    color: #1d4ed8;
    background: #fff;
}

.copy-navigation {
    min-height: 34px;
    margin-top: 9px;
    padding: 0 10px;
    font-size: 12px;
}

.navigation-warnings {
    display: grid;
    gap: 5px;
    margin: 12px 0 0;
    padding-left: 18px;
}

.navigation-alias {
    margin-top: 12px !important;
    padding: 9px 10px;
    border-left: 3px solid #d97706;
    background: #fffbeb;
    color: #82500a !important;
}

.summary-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 99px;
    color: #fff;
    font-size: 12px;
    font-weight: 650;
}

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

.metric {
    padding: 10px;
    border-radius: 10px;
    background: var(--surface-soft);
}

.metric strong {
    display: block;
    margin-bottom: 2px;
    font-size: 20px;
}

.metric span {
    color: var(--muted);
    font-size: 12px;
}

.summary-note,
.selection-panel p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.detail-meta {
    display: grid;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.detail-meta li {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
}

.detail-meta span:first-child {
    color: var(--muted);
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.detail-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--ink);
    text-decoration: none;
}

.hotel-candidates {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.hotel-candidates h3 {
    margin: 0 0 10px;
    font-size: 14px;
}

.hotel-candidates ol {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hotel-candidates li {
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.hotel-candidate-title {
    display: grid;
    gap: 3px;
}

.hotel-candidate-title span {
    color: var(--muted);
    font-size: 11px;
}

.hotel-candidate-title strong {
    font-size: 13px;
}

.hotel-candidates p {
    margin-top: 6px;
}

.hotel-candidates .hotel-candidate-check {
    color: #8a4b08;
}

.hotel-candidates a {
    display: inline-flex;
    margin-top: 7px;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}

.hotel-candidates .hotel-price-note {
    margin-top: 10px;
}

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

.itinerary-item button {
    display: grid;
    width: 100%;
    min-height: 64px;
    grid-template-columns: 50px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 10px;
    text-align: left;
}

.itinerary-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 650;
}

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

.itinerary-copy span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.map-marker {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 8px;
    color: #fff;
    background: var(--marker-color);
    box-shadow: 0 4px 11px rgba(16, 24, 40, 0.26);
    transform: rotate(-45deg);
    font-size: 11px;
    font-weight: 700;
}

.map-marker span {
    transform: rotate(45deg);
}

.map-marker[data-kind="hotel"] {
    border-radius: 8px;
}

.map-marker[data-kind="must"] {
    background: var(--must);
    border-radius: 50%;
}

.map-marker[data-navigation="required"] {
    border-radius: 7px;
    background: #d97706;
    transform: rotate(45deg);
}

.map-marker[data-navigation="required"] span {
    transform: rotate(-45deg);
}

.map-marker[data-navigation="landmark"] {
    border-radius: 50%;
    background: #0f766e;
}

.map-marker[data-navigation="optional"] {
    border-style: dashed;
    border-radius: 50%;
    background: var(--d);
}

.amap-info-content {
    min-width: 230px;
    max-width: 320px;
    padding: 2px;
    color: var(--ink);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.amap-info-content h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.amap-info-content p {
    margin: 5px 0;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.5;
}

.print-maps {
    display: none;
}

.page-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    padding: 22px 0 4px;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 980px) {
    .page-shell {
        padding: 16px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .map-stage {
        min-height: 58vh;
    }

    .detail-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .itinerary-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .page-shell {
        padding: 10px;
    }

    .header-actions,
    .header-actions button,
    .header-actions .header-link {
        width: 100%;
    }

    .control-strip {
        align-items: stretch;
    }

    .plan-selector {
        width: 100%;
    }

    .plan-selector legend {
        width: 100%;
    }

    .plan-choice {
        flex: 1 1 130px;
        justify-content: center;
    }

    .compare-control,
    .select-control {
        flex: 1 1 100%;
    }

    .select-control select {
        flex: 1;
    }

    .node-filter {
        width: 100%;
    }

    .node-filter summary {
        justify-content: center;
    }

    .node-filter-options {
        left: 0;
        right: auto;
        width: 100%;
    }

    .map-stage {
        min-height: 500px;
    }

    .map-legend {
        gap: 7px 10px;
    }

    .detail-column {
        grid-template-columns: 1fr;
    }

    .itinerary-panel {
        grid-column: auto;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body {
        background: #fff;
    }

    .page-shell {
        width: 100%;
        padding: 0;
    }

    .page-header,
    .control-strip,
    .runtime-status,
    .map-layout,
    .page-footer {
        display: none !important;
    }

    .print-maps {
        display: block;
    }

    .print-maps article {
        page-break-after: always;
    }

    .print-maps article:last-child {
        page-break-after: auto;
    }

    .print-maps h2 {
        margin: 0 0 6mm;
        font-size: 18pt;
    }

    .print-maps img {
        display: block;
        width: auto;
        max-width: 100%;
        max-height: 175mm;
        margin: 0 auto;
    }
}
