:root {
    --bg: #090d13;
    --surface: #0f151e;
    --surface-2: #141c27;
    --surface-3: #192331;
    --text: #f2f5f7;
    --text-soft: #b2bcc7;
    --muted: #6e7986;
    --line: rgba(255, 255, 255, 0.085);
    --line-strong: rgba(255, 255, 255, 0.16);
    --cyan: #69e4ff;
    --cyan-soft: rgba(105, 228, 255, 0.11);
    --green: #b7f34a;
    --green-soft: rgba(183, 243, 74, 0.11);
    --orange: #ffb24f;
    --orange-soft: rgba(255, 178, 79, 0.12);
    --purple: #ad9cff;
    --pink: #ff8bb5;
    --red: #ff786f;
    --font: "Manrope", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--bg);
    font-size: 17px;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 78% 4%, rgba(54, 113, 151, 0.09), transparent 26%),
        radial-gradient(circle at 15% 76%, rgba(119, 98, 193, 0.06), transparent 30%),
        var(--bg);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

button,
input,
select { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

.page-glow {
    position: fixed;
    z-index: -1;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
}

.glow-one {
    top: -300px;
    right: -60px;
    background: rgba(54, 151, 181, 0.13);
}

.glow-two {
    bottom: -340px;
    left: -120px;
    background: rgba(183, 243, 74, 0.06);
}

.site-header {
    position: sticky;
    z-index: 60;
    top: 0;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    gap: 28px;
    align-items: center;
    min-height: 76px;
    padding: 0 clamp(18px, 4vw, 62px);
    background: rgba(9, 13, 19, 0.86);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(24px);
}

.brand {
    display: inline-flex;
    gap: 11px;
    align-items: center;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 11px;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-copy strong,
.brand-copy small { display: block; }

.brand-copy strong {
    font-size: 0.82rem;
    font-weight: 750;
}

.brand-copy small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.52rem;
    font-weight: 750;
    letter-spacing: 0.12em;
}

.header-center { text-align: center; }

.header-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.54rem;
    font-weight: 750;
    letter-spacing: 0.08em;
}

.header-center strong {
    font-size: 0.82rem;
    font-weight: 650;
}

.header-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.header-button {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 9px 12px;
    color: var(--text-soft);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-radius: 9px;
    text-decoration: none;
    font-size: 0.62rem;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.header-button:hover {
    color: var(--text);
    background: rgba(255,255,255,0.055);
    border-color: var(--line-strong);
}

.support-button {
    color: var(--orange);
    background: var(--orange-soft);
    border-color: rgba(255,178,79,0.22);
}

.support-button:hover {
    color: #ffd18e;
    background: rgba(255,178,79,0.16);
    border-color: rgba(255,178,79,0.34);
}

.header-button span {
    display: grid;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    place-items: center;
    color: #0d1209;
    background: var(--green);
    border-radius: 5px;
    font-size: 0.52rem;
    font-weight: 800;
}

.app-main {
    width: min(1760px, calc(100% - clamp(28px, 5vw, 92px)));
    margin: 0 auto;
    padding: 0 0 82px;
}

.mode-bar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-top: 18px;
    padding: 12px 14px 12px 18px;
    background: rgba(255,255,255,0.018);
    border: 1px solid var(--line);
    border-radius: 14px;
}

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

.mode-copy span {
    color: var(--muted);
    font-size: 0.5rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.mode-copy strong {
    margin-top: 3px;
    font-size: 0.68rem;
    font-weight: 650;
}

.mode-switch {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    min-width: 250px;
    padding: 4px;
    background: rgba(255,255,255,0.028);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.mode-switch button {
    padding: 8px 13px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 7px;
    font-size: 0.62rem;
    font-weight: 650;
    cursor: pointer;
}

.mode-switch button[aria-selected="true"] {
    color: #10160b;
    background: var(--green);
}

.intro {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(290px, 0.5fr);
    gap: clamp(40px, 8vw, 130px);
    align-items: end;
    padding: clamp(54px, 7vw, 96px) 0 42px;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.intro h1 {
    max-width: 920px;
    margin: 14px 0 0;
    font-size: clamp(2.5rem, 5.3vw, 5.6rem);
    font-weight: 650;
    letter-spacing: -0.065em;
    line-height: 1.04;
}

.intro-copy > p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.8;
}

.intro-status {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 13px;
    align-items: center;
    margin-top: 20px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}

.intro-status span {
    padding: 5px 8px;
    color: var(--cyan);
    background: var(--cyan-soft);
    border-radius: 7px;
    font-size: 0.56rem;
    font-weight: 750;
}

.intro-status strong {
    font-size: 0.75rem;
    font-weight: 600;
}

.preset-section {
    margin-bottom: 16px;
    padding: 18px 20px;
    background: rgba(255,255,255,0.018);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.preset-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 13px;
}

.preset-heading span:first-child {
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 600;
}

.preset-heading span:last-child {
    color: var(--muted);
    font-size: 0.58rem;
}

.preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-button {
    padding: 8px 11px;
    color: var(--text-soft);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 0.62rem;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.preset-button:hover {
    color: var(--text);
    background: var(--cyan-soft);
    border-color: rgba(105,228,255,0.25);
    transform: translateY(-1px);
}

.sponsor-slot {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,1fr) 210px auto;
    gap: 24px;
    align-items: center;
    margin-bottom: 16px;
    padding: 18px 20px;
    overflow: hidden;
    background:
        linear-gradient(105deg, rgba(255,178,79,0.1), transparent 38%),
        rgba(255,255,255,0.018);
    border: 1px solid rgba(255,178,79,0.2);
    border-radius: 16px;
}

.sponsor-copy strong,
.sponsor-copy p { display: block; }

.sponsor-badge {
    display: inline-flex;
    margin-bottom: 8px;
    padding: 4px 7px;
    color: var(--orange);
    background: var(--orange-soft);
    border: 1px solid rgba(255,178,79,0.2);
    border-radius: 6px;
    font-size: 0.48rem;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.sponsor-copy strong {
    font-size: 0.76rem;
    font-weight: 650;
}

.sponsor-copy p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.59rem;
    line-height: 1.6;
}

.sponsor-visual {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 13px 44px 13px 13px;
    background: rgba(255,178,79,0.045);
    border: 1px solid rgba(255,178,79,0.14);
    border-radius: 11px;
}

.sponsor-visual i {
    display: block;
    height: 5px;
    background: rgba(255,178,79,0.13);
    border-radius: 20px;
}

.sponsor-visual i:nth-child(2) { width: 64%; }
.sponsor-visual i:nth-child(3) { width: 82%; }

.sponsor-visual b {
    position: absolute;
    right: 12px;
    top: 50%;
    color: var(--orange);
    font-size: 1rem;
    transform: translateY(-50%);
}

.sponsor-actions {
    display: flex;
    gap: 7px;
}

.sponsor-actions a {
    padding: 8px 10px;
    color: var(--text-soft);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.56rem;
}

.sponsor-actions a:last-child {
    color: var(--orange);
    background: var(--orange-soft);
    border-color: rgba(255,178,79,0.22);
}

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

.map-panel,
.inspector {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 24px 70px rgba(0,0,0,0.28);
}

.map-panel {
    min-width: 0;
    overflow: hidden;
    border-radius: 22px;
}

.map-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    min-height: 56px;
    padding: 0 17px;
    border-bottom: 1px solid var(--line);
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.map-legend span {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--muted);
    font-size: 0.56rem;
}

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.legend-dot.start { background: var(--cyan); }
.legend-dot.bridge { background: var(--purple); }
.legend-dot.money { background: var(--green); }

.map-controls {
    display: flex;
    gap: 5px;
}

.map-controls button {
    display: grid;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    place-items: center;
    color: var(--text-soft);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.62rem;
    cursor: pointer;
}

.map-controls button:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.map-viewport {
    position: relative;
    height: min(660px, 68vh);
    min-height: 520px;
    overflow: hidden;
    background:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px),
        #0b1119;
    background-size: 32px 32px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.map-viewport.dragging { cursor: grabbing; }

.map-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 1780px;
    height: 1060px;
    transform-origin: 0 0;
    will-change: transform;
}

.layer-bands,
.edge-layer,
.node-layer {
    position: absolute;
    inset: 0;
}

.layer-band {
    position: absolute;
    top: 34px;
    width: 184px;
    height: 984px;
    border-right: 1px solid rgba(255,255,255,0.035);
    border-left: 1px solid rgba(255,255,255,0.018);
}

.layer-band::before {
    position: absolute;
    top: 0;
    left: 18px;
    color: rgba(255,255,255,0.28);
    content: attr(data-label);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.layer-band::after {
    position: absolute;
    top: 22px;
    left: 18px;
    width: 22px;
    height: 2px;
    background: var(--band-color, var(--cyan));
    content: "";
    opacity: 0.7;
}

.edge-layer {
    overflow: visible;
    pointer-events: none;
}

.edge {
    fill: none;
    stroke: rgba(161, 177, 194, 0.105);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
    transition: stroke 180ms ease, stroke-width 180ms ease, opacity 180ms ease;
}

.edge.related {
    stroke: rgba(105,228,255,0.26);
    stroke-width: 1.5;
}

.edge.active {
    stroke: var(--green);
    stroke-width: 2.4;
    filter: drop-shadow(0 0 5px rgba(183,243,74,0.32));
}

.edge.dimmed { opacity: 0.25; }

.map-node {
    --node-accent: var(--cyan);
    position: absolute;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    width: 176px;
    min-height: 58px;
    padding: 9px 12px;
    color: rgba(226,232,238,0.58);
    text-align: left;
    background: rgba(15,21,30,0.92);
    border: 1px solid rgba(255,255,255,0.075);
    border-radius: 11px;
    cursor: pointer;
    opacity: 0.7;
    box-shadow: 0 10px 24px rgba(0,0,0,0.14);
    transition: color 170ms ease, background 170ms ease, border-color 170ms ease, opacity 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.map-node:hover {
    color: var(--text-soft);
    background: var(--surface-2);
    border-color: var(--line-strong);
    opacity: 1;
    transform: translateY(-2px);
}

.map-node:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

.node-symbol {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: var(--node-accent);
    background: color-mix(in srgb, var(--node-accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--node-accent) 20%, transparent);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.node-copy {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 650;
}

.map-node[data-layer="resource"] { --node-accent: var(--cyan); }
.map-node[data-layer="track"] { --node-accent: #64a9ff; }
.map-node[data-layer="content"] { --node-accent: var(--purple); }
.map-node[data-layer="channel"] { --node-accent: var(--pink); }
.map-node[data-layer="asset"] { --node-accent: var(--orange); }
.map-node[data-layer="offer"] { --node-accent: #ff8d67; }
.map-node[data-layer="money"] { --node-accent: var(--green); }

.map-node.available {
    color: var(--text);
    background: color-mix(in srgb, var(--node-accent) 7%, rgba(15,21,30,0.96));
    border-color: color-mix(in srgb, var(--node-accent) 42%, transparent);
    opacity: 1;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--node-accent) 5%, transparent), 0 0 24px color-mix(in srgb, var(--node-accent) 8%, transparent);
    animation: nodeBreathe 2.8s ease-in-out infinite;
}

.map-node.selected,
.map-node.passed {
    color: #10160b;
    background: var(--green);
    border-color: var(--green);
    opacity: 1;
    box-shadow: 0 0 25px rgba(183,243,74,0.23);
}

.map-node.selected {
    transform: translateY(-2px) scale(1.025);
}

.map-node.selected .node-symbol,
.map-node.passed .node-symbol {
    color: #10160b;
    background: rgba(16,22,11,0.1);
    border-color: rgba(16,22,11,0.18);
}

.map-node.blocked {
    opacity: 0.32;
}

.map-node.money-node:not(.available):not(.selected):not(.passed) {
    border-color: rgba(183,243,74,0.12);
}

@keyframes nodeBreathe {
    0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--node-accent) 5%, transparent), 0 0 16px color-mix(in srgb, var(--node-accent) 5%, transparent); }
    50% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--node-accent) 12%, transparent), 0 0 27px color-mix(in srgb, var(--node-accent) 12%, transparent); }
}

.drag-hint {
    position: absolute;
    right: 15px;
    bottom: 13px;
    padding: 6px 9px;
    color: rgba(255,255,255,0.32);
    background: rgba(9,13,19,0.72);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    font-size: 11px;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.path-dock {
    padding: 17px 19px 19px;
    border-top: 1px solid var(--line);
}

.path-dock-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.path-dock-head strong {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
    font-weight: 650;
}

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

.path-actions button {
    padding: 7px 9px;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.58rem;
    cursor: pointer;
}

.path-actions button:hover:not(:disabled) {
    color: var(--text-soft);
    border-color: var(--line-strong);
}

.path-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.path-chips {
    display: flex;
    gap: 7px;
    align-items: center;
    min-height: 35px;
    margin-top: 14px;
    overflow-x: auto;
    scrollbar-width: none;
}

.path-chips::-webkit-scrollbar { display: none; }

.path-chip {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 7px;
    align-items: center;
    padding: 7px 9px;
    color: var(--text-soft);
    background: rgba(255,255,255,0.028);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.6rem;
}

.path-chip::after {
    margin-left: 2px;
    color: var(--muted);
    content: "→";
}

.path-chip:last-child {
    color: #10160b;
    background: var(--green);
    border-color: var(--green);
}

.path-chip:last-child::after { display: none; }

.empty-path {
    color: var(--muted);
    font-size: 0.62rem;
}

.inspector {
    position: sticky;
    top: 92px;
    min-height: 640px;
    overflow: hidden;
    border-radius: 22px;
}

.inspector-empty,
.node-detail,
.result-panel {
    min-height: 640px;
    padding: 28px;
}

.empty-index,
.detail-position {
    color: var(--muted);
    font-size: 0.54rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.empty-symbol {
    display: grid;
    width: 54px;
    height: 54px;
    margin-top: 48px;
    place-items: center;
    color: var(--cyan);
    background: var(--cyan-soft);
    border: 1px solid rgba(105,228,255,0.17);
    border-radius: 15px;
    font-size: 1.45rem;
}

.inspector h2 {
    margin: 24px 0 12px;
    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.04em;
    line-height: 1.25;
}

.inspector-empty > p,
.node-detail > p,
.result-panel > p {
    margin: 0;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.8;
}

.start-options {
    display: grid;
    gap: 8px;
    margin-top: 34px;
}

.start-options button {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    width: 100%;
    padding: 13px 14px;
    color: var(--text-soft);
    text-align: left;
    background: rgba(255,255,255,0.022);
    border: 1px solid var(--line);
    border-radius: 11px;
    cursor: pointer;
}

.start-options button:hover {
    color: var(--text);
    background: var(--cyan-soft);
    border-color: rgba(105,228,255,0.24);
}

.start-options span {
    color: var(--muted);
    font-size: 0.58rem;
}

.start-options strong {
    font-size: 0.66rem;
    font-weight: 650;
}

.detail-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.detail-layer {
    padding: 6px 8px;
    color: var(--cyan);
    background: var(--cyan-soft);
    border-radius: 7px;
    font-size: 0.56rem;
    font-weight: 750;
}

.detail-block {
    margin-top: 26px;
    padding: 16px;
    background: rgba(255,255,255,0.022);
    border: 1px solid var(--line);
    border-radius: 11px;
}

.detail-block + .detail-block { margin-top: 8px; }

.detail-block span,
.next-head span {
    display: block;
    color: var(--muted);
    font-size: 0.56rem;
    font-weight: 700;
}

.detail-block strong {
    display: block;
    margin-top: 7px;
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.65;
}

.next-section {
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.next-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.next-head small {
    color: var(--muted);
    font-size: 0.54rem;
}

.next-list {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.next-option {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    width: 100%;
    padding: 11px 12px;
    color: var(--text-soft);
    text-align: left;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.62rem;
}

.next-option:hover {
    color: var(--text);
    background: var(--cyan-soft);
    border-color: rgba(105,228,255,0.22);
}

.next-option span:last-child {
    color: var(--cyan);
}

.result-panel {
    background:
        radial-gradient(circle at 95% 4%, rgba(183,243,74,0.11), transparent 34%),
        var(--surface);
}

.result-badge {
    display: inline-flex;
    padding: 6px 9px;
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid rgba(183,243,74,0.17);
    border-radius: 8px;
    font-size: 0.56rem;
    font-weight: 750;
}

.route-signals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
    margin-top: 25px;
}

.route-signal {
    padding: 13px;
    background: rgba(255,255,255,0.022);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.route-signal span,
.route-signal strong { display: block; }

.route-signal span {
    color: var(--muted);
    font-size: 0.54rem;
}

.route-signal strong {
    margin-top: 6px;
    font-size: 0.72rem;
    font-weight: 650;
}

.plan-section {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.plan-section ol {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: plan;
}

.plan-section li {
    position: relative;
    min-height: 24px;
    padding-left: 34px;
    color: var(--text-soft);
    font-size: 0.64rem;
    line-height: 1.55;
    counter-increment: plan;
}

.plan-section li::before {
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: var(--green);
    background: var(--green-soft);
    border-radius: 7px;
    content: "D" counter(plan);
    font-size: 0.5rem;
    font-weight: 800;
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 24px;
}

.result-sponsor {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    padding: 13px;
    color: var(--text-soft);
    background: linear-gradient(120deg, rgba(255,178,79,0.08), rgba(255,255,255,0.018));
    border: 1px solid rgba(255,178,79,0.17);
    border-radius: 10px;
    text-decoration: none;
}

.result-sponsor span {
    color: var(--orange);
    font-size: 0.45rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.result-sponsor strong { font-size: 0.64rem; font-weight: 650; }
.result-sponsor small { color: var(--muted); font-size: 0.53rem; }

.primary-button,
.secondary-button {
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 0.62rem;
    font-weight: 750;
    cursor: pointer;
}

.primary-button {
    color: #10160b;
    background: var(--green);
    border: 1px solid var(--green);
}

.secondary-button {
    color: var(--text-soft);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
}

.primary-button:hover { background: #c5fa62; }
.secondary-button:hover { color: var(--text); border-color: var(--line-strong); }

.principles {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 12px;
    margin-top: 16px;
}

.principles article {
    display: grid;
    grid-template-columns: 34px 1fr;
    column-gap: 10px;
    padding: 18px;
    background: rgba(255,255,255,0.018);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.principles span {
    grid-row: 1 / 3;
    color: var(--cyan);
    font-size: 0.58rem;
    font-weight: 800;
}

.principles strong {
    font-size: 0.7rem;
    font-weight: 650;
}

.principles p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.61rem;
    line-height: 1.6;
}

.saved-dialog {
    width: min(620px, calc(100vw - 30px));
    max-height: min(720px, calc(100vh - 40px));
    padding: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    box-shadow: 0 36px 120px rgba(0,0,0,0.62);
}

.saved-dialog::backdrop {
    background: rgba(4,7,11,0.8);
    backdrop-filter: blur(10px);
}

.saved-dialog-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: start;
    padding: 24px;
    border-bottom: 1px solid var(--line);
}

.saved-dialog-head h2 {
    margin: 7px 0 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.035em;
}

.saved-dialog-head button {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
}

.saved-route-list {
    display: grid;
    max-height: 560px;
    overflow-y: auto;
    padding: 12px 24px 24px;
}

.saved-route {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.saved-route:last-child { border-bottom: 0; }

.saved-route strong,
.saved-route span { display: block; }

.saved-route strong {
    font-size: 0.72rem;
    font-weight: 650;
}

.saved-route span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.58rem;
}

.saved-route small {
    display: inline-flex;
    margin-top: 6px;
    padding: 3px 5px;
    color: var(--cyan);
    background: var(--cyan-soft);
    border-radius: 5px;
    font-size: 0.48rem;
}

.saved-route-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.saved-route-actions button {
    padding: 7px 9px;
    color: var(--text-soft);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.56rem;
}

.saved-empty {
    padding: 70px 20px;
    color: var(--muted);
    text-align: center;
    font-size: 0.68rem;
    line-height: 1.7;
}

.donate-dialog {
    width: min(440px, calc(100vw - 28px));
    padding: 28px;
    color: var(--text);
    background:
        radial-gradient(circle at 92% 5%, rgba(183,243,74,0.11), transparent 30%),
        var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    box-shadow: 0 36px 120px rgba(0,0,0,0.68);
}

.donate-dialog::backdrop {
    background: rgba(4,7,11,0.84);
    backdrop-filter: blur(11px);
}

.donate-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
}

.donate-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-right: 32px;
}

.donate-brand img {
    width: 46px;
    height: 46px;
    border-radius: 13px;
}

.donate-brand span,
.donate-brand strong { display: block; }

.donate-brand span {
    color: var(--green);
    font-size: 0.48rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.donate-brand strong {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 650;
}

.donate-dialog > p {
    margin: 18px 0;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.75;
}

.donate-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 4px;
    background: rgba(255,255,255,0.026);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.donate-tabs button {
    padding: 8px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 7px;
    font-size: 0.62rem;
    cursor: pointer;
}

.donate-tabs button[aria-selected="true"] {
    color: #10160b;
    background: var(--green);
}

.donate-qr-panel {
    display: grid;
    justify-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--line);
    border-radius: 14px;
}

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

.donate-qr-panel img {
    width: min(230px, 100%);
    aspect-ratio: 1;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
}

.donate-qr-panel span { color: var(--text-soft); font-size: 0.6rem; }

.donate-note {
    display: block;
    margin-top: 14px;
    color: var(--muted);
    text-align: center;
    font-size: 0.53rem;
    line-height: 1.6;
}

.toast {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: 28px;
    padding: 11px 15px;
    color: #10160b;
    background: var(--green);
    border-radius: 9px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.4);
    font-size: 0.64rem;
    font-weight: 750;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Readability floor: dense maps still need legible supporting text. */
.brand-copy small,
.header-kicker,
.mode-copy span,
.eyebrow,
.preset-heading span:last-child,
.sponsor-badge,
.map-legend span,
.empty-index,
.detail-position,
.detail-layer,
.detail-block span,
.next-head span,
.next-head small,
.result-badge,
.route-signal span,
.saved-route span,
.saved-route small,
.donate-brand span,
.donate-note {
    font-size: 0.64rem;
}

.header-button,
.mode-switch button,
.preset-button,
.sponsor-actions a,
.path-actions button,
.path-chip,
.empty-path,
.start-options span,
.start-options strong,
.next-option,
.plan-section li,
.primary-button,
.secondary-button,
.result-sponsor strong,
.result-sponsor small,
.saved-route-actions button,
.donate-tabs button,
.donate-qr-panel span,
.toast {
    font-size: 0.72rem;
}

.intro-copy > p { font-size: 0.9rem; }
.intro-status span { font-size: 0.64rem; }
.intro-status strong { font-size: 0.82rem; }
.preset-heading span:first-child { font-size: 0.76rem; }
.sponsor-copy strong { font-size: 0.84rem; }
.sponsor-copy p { font-size: 0.68rem; }
.inspector-empty > p,
.node-detail > p,
.result-panel > p { font-size: 0.78rem; }
.detail-block strong { font-size: 0.76rem; }
.route-signal strong { font-size: 0.78rem; }
.principles strong { font-size: 0.76rem; }
.principles p { font-size: 0.69rem; }
.saved-route strong { font-size: 0.78rem; }
.donate-dialog > p { font-size: 0.76rem; }

@media (max-width: 1280px) {
    .app-main { width: min(100% - 30px, 1540px); }
    .explorer-layout { grid-template-columns: minmax(0,1fr) 310px; }
    .inspector-empty,
    .node-detail,
    .result-panel { padding: 24px; }
}

@media (max-width: 1020px) {
    .site-header { grid-template-columns: 1fr auto; }
    .header-center { display: none; }
    .explorer-layout { grid-template-columns: 1fr; }
    .inspector {
        position: static;
        min-height: 0;
    }
    .inspector-empty,
    .node-detail,
    .result-panel { min-height: 0; }
    .start-options { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .route-signals { grid-template-columns: repeat(4,minmax(0,1fr)); }
    .sponsor-slot { grid-template-columns: minmax(0,1fr) auto; }
    .sponsor-visual { display: none; }
}

@media (max-width: 720px) {
    .site-header {
        min-height: 62px;
        padding: 0 14px;
    }
    .brand-copy small,
    .header-actions .header-button:last-child { display: none; }
    .header-button { padding: 8px 10px; }
    .app-main { width: calc(100% - 20px); }
    .mode-bar {
        align-items: stretch;
        margin-top: 10px;
        padding: 10px;
    }
    .mode-copy { display: none; }
    .mode-switch { width: 100%; min-width: 0; }
    .intro {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 44px 4px 30px;
    }
    .intro h1 { font-size: clamp(2.35rem, 12vw, 3.5rem); }
    .intro-copy > p { font-size: 0.84rem; }
    .preset-heading span:last-child { display: none; }
    .preset-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }
    .preset-list::-webkit-scrollbar { display: none; }
    .preset-button { flex: 0 0 auto; }
    .sponsor-slot {
        grid-template-columns: 1fr;
        gap: 13px;
        padding: 16px;
    }
    .sponsor-actions { flex-wrap: wrap; }
    .sponsor-actions a { flex: 1 1 auto; text-align: center; }
    .map-toolbar { min-height: 52px; padding: 0 12px; }
    .map-legend span:nth-child(2) { display: none; }
    .map-viewport {
        height: 62vh;
        min-height: 450px;
    }
    .path-dock { padding: 15px; }
    .path-dock-head { align-items: flex-start; }
    .path-actions button { font-size: 0; }
    .path-actions button::after { font-size: 0.7rem; }
    #undoPath::after { content: "撤回"; }
    #resetPath::after { content: "重置"; }
    .drag-hint { display: none; }
    .start-options { grid-template-columns: 1fr; }
    .route-signals { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .principles { grid-template-columns: 1fr; }
    .inspector h2 { font-size: 1.55rem; }
}

@media (max-width: 420px) {
    .brand-copy strong { font-size: 0.74rem; }
    .header-button { font-size: 0.66rem; }
    .intro h1 { font-size: 2.5rem; }
    .preset-section { padding: 15px; }
    .map-panel,
    .inspector { border-radius: 18px; }
    .map-legend { gap: 9px; }
    .map-controls button { min-width: 28px; padding: 0 7px; }
    .result-actions { grid-template-columns: 1fr; }
    .donate-dialog { padding: 22px 18px 18px; }
}

@media (max-width: 360px) {
    .brand-copy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
