/* Intelligent map extensions */
.eth-map-shell {
    --active-orbit-color: #D7492A;
    background:
        radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--active-orbit-color) 28%, transparent), transparent 30%),
        radial-gradient(circle at 84% 14%, rgba(56, 189, 248, 0.12), transparent 30%),
        radial-gradient(circle at 68% 84%, rgba(167, 139, 250, 0.13), transparent 34%),
        linear-gradient(135deg, #020202 0%, #070707 46%, #110604 100%);
    transition: background 420ms ease;
}

.eth-knowledge-actions {
    display: grid;
    grid-template-columns: minmax(220px, 380px) auto auto auto;
    align-items: center;
}

.eth-global-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    min-width: 220px;
    padding: 0 10px;
    border-radius: 16px;
    background: rgba(0,0,0,.32);
    border: 1px solid rgba(255,255,255,.11);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.eth-global-search > span {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 9px;
    background: rgba(255,255,255,.08);
    color: #d6d3d1;
    font-size: 10px;
    font-weight: 950;
}

.eth-global-search input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff7ed;
    font-size: 13px;
    font-weight: 750;
}

.eth-global-search input::placeholder {
    color: rgba(214,211,209,.68);
}

.eth-global-search-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(560px, calc(100vw - 28px));
    max-height: min(560px, calc(100dvh - 120px));
    overflow: auto;
    z-index: 150;
    padding: 10px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(18,18,22,.96), rgba(7,7,9,.91));
    border: 1px solid rgba(255,255,255,.13);
    box-shadow: 0 28px 90px rgba(0,0,0,.68), 0 0 50px rgba(215,73,42,.14);
    backdrop-filter: blur(24px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(.98);
    transition: opacity .18s ease, transform .18s ease;
}

.eth-global-search-panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.eth-search-result {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
    gap: 4px 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    color: #fffaf6;
    text-align: left;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.eth-search-result + .eth-search-result { margin-top: 8px; }
.eth-search-result:hover {
    transform: translateY(-1px);
    background: rgba(215,73,42,.12);
    border-color: rgba(215,73,42,.34);
}
.eth-search-result span {
    grid-row: span 2;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 14px;
    background: rgba(215,73,42,.14);
    color: #fed7aa;
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.eth-search-result strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 950;
}
.eth-search-result small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #a8a29e;
    font-size: 12px;
}
.eth-search-empty {
    padding: 16px;
    color: #d6d3d1;
    font-size: 13px;
    line-height: 1.5;
}

.eth-connection-type-bar {
    position: absolute;
    z-index: 84;
    left: 18px;
    top: 96px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(18,18,22,.76), rgba(7,7,9,.58));
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 16px 48px rgba(0,0,0,.36);
    backdrop-filter: blur(18px);
}
.eth-connection-type-bar span {
    color: #a8a29e;
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.eth-connection-type-bar select {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.11);
    background: rgba(0,0,0,.38);
    color: #fff7ed;
    font-size: 12px;
    font-weight: 850;
    outline: none;
}
.eth-connection-type-bar option { color: #111827; background: #fff; }

.eth-map-legend-panel {
    position: absolute;
    z-index: 100;
    left: 18px;
    bottom: 86px;
    width: min(410px, calc(100vw - 36px));
    padding: 16px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(18,18,22,.94), rgba(7,7,9,.86));
    border: 1px solid rgba(255,255,255,.13);
    box-shadow: 0 24px 80px rgba(0,0,0,.62), 0 0 42px rgba(215,73,42,.18);
    backdrop-filter: blur(22px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(.98);
    transition: opacity .18s ease, transform .18s ease;
}
.eth-map-legend-panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.eth-legend-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}
.eth-legend-list div {
    display: grid;
    grid-template-columns: 34px minmax(0, .64fr) minmax(0, 1.36fr);
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.07);
}
.eth-legend-list strong { font-size: 12px; font-weight: 950; color: #fffaf6; }
.eth-legend-list span { font-size: 12px; color: #b8b2ad; line-height: 1.35; }
.legend-dot, .legend-orbit, .legend-zoom {
    width: 24px; height: 24px; border-radius: 999px; display: inline-block;
    background: radial-gradient(circle at 35% 26%, #fff, #ff784e 36%, #D7492A 100%);
    box-shadow: 0 0 26px rgba(215,73,42,.7);
}
.legend-dot.energy { box-shadow: 0 0 34px rgba(255,255,255,.62), 0 0 44px rgba(215,73,42,.72); }
.legend-orbit { border-radius: 8px; transform: rotate(45deg); background: radial-gradient(circle, #fff, #38bdf8 45%, #0f172a 100%); box-shadow: 0 0 30px rgba(56,189,248,.55); }
.legend-zoom { background: radial-gradient(circle, #fff, #a78bfa 45%, #111827 100%); box-shadow: 0 0 30px rgba(167,139,250,.55); }
.legend-line { width: 30px; height: 0; border-top: 3px solid #ff784e; display: inline-block; }
.legend-line.dashed { border-top-style: dotted; border-top-color: #ffd3c2; }
.legend-line.double { height: 8px; border-top: 3px solid #38bdf8; border-bottom: 3px solid #38bdf8; }

.eth-mental-breadcrumb {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin: 8px 0 22px;
    padding: 10px 12px;
    border-radius: 18px;
    background: rgba(255,255,255,.055);
    border: 1px solid rgba(255,255,255,.10);
    color: #d6d3d1;
    font-size: 13px;
    font-weight: 850;
}
.eth-mental-breadcrumb a { color: #fed7aa; }
.eth-mental-breadcrumb strong { color: #fffaf6; }
.eth-neuron-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.eth-orphan-page .eth-content-wrap,
.eth-orphan-wrap { width: min(1180px, 100%); }
.eth-orphan-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 20px;
    border-radius: 28px;
    margin-bottom: 18px;
}
.eth-orphan-summary div {
    min-width: 180px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(215,73,42,.12);
    border: 1px solid rgba(215,73,42,.26);
}
.eth-orphan-summary span,
.eth-orphan-summary strong { display: block; }
.eth-orphan-summary span { font-size: 42px; line-height: .9; font-weight: 950; color: #fff7ed; }
.eth-orphan-summary strong { margin-top: 8px; color: #fed7aa; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.eth-orphan-summary p { color: #c9c3bd; line-height: 1.6; }
.eth-orphan-grid { display: grid; gap: 14px; }
.eth-orphan-card {
    --orphan-color: #D7492A;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 18px;
    border-radius: 28px;
    position: relative;
    overflow: hidden;
}
.eth-orphan-card::before {
    content: "";
    position: absolute;
    inset: -40% auto auto -10%;
    width: 280px;
    height: 280px;
    border-radius: 999px;
    background: radial-gradient(circle, color-mix(in srgb, var(--orphan-color) 34%, transparent), transparent 70%);
    pointer-events: none;
}
.eth-orphan-card > * { position: relative; z-index: 1; }
.eth-orphan-orb {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: radial-gradient(circle at 35% 25%, #fff, var(--orphan-color) 42%, #100403 100%);
    box-shadow: 0 0 34px color-mix(in srgb, var(--orphan-color) 70%, transparent);
    font-size: 24px;
}
.eth-orphan-copy h2 {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 950;
    letter-spacing: -.045em;
}
.eth-orphan-copy p { margin-top: 6px; color: #b8b2ad; line-height: 1.5; }
.eth-orphan-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.eth-orphan-meta span,
.compact-tags span {
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.09);
    color: #d6d3d1;
    font-size: 11px;
    font-weight: 800;
}
.eth-orphan-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.eth-map-shell .eth-map-action[href],
.eth-top-actions a.compact,
.eth-btn-primary.compact,
.eth-btn-secondary.compact {
    min-height: 38px;
    padding-inline: 14px;
    border-radius: 14px;
    font-size: 12px;
}

@media (max-width: 1120px) {
    .eth-knowledge-actions { grid-template-columns: minmax(180px, 1fr) auto auto; }
    .eth-knowledge-actions #aiSuggestBtn { display: none; }
}

@media (max-width: 900px) {
    .eth-knowledge-actions {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        width: 100%;
    }
    .eth-global-search { min-width: 0; }
    .eth-global-search > span { display: none; }
    .eth-connection-type-bar { top: 148px; left: 12px; right: 12px; justify-content: space-between; }
    .eth-map-floating-toolbar { left: 12px; max-width: calc(100vw - 24px); overflow-x: auto; }
    .eth-neuron-sheet { grid-template-columns: auto minmax(0, 1fr); }
    .eth-neuron-sheet-actions { grid-column: 1 / -1; flex-wrap: wrap; }
    .eth-orphan-card { grid-template-columns: auto minmax(0, 1fr); }
    .eth-orphan-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 620px) {
    .eth-knowledge-actions { grid-template-columns: minmax(0, 1fr) auto; }
    .eth-knowledge-actions #quickAddConstellationBtn,
    .eth-knowledge-actions #quickAddNeuronBtn { display: none; }
    .eth-map-legend-panel { left: 12px; right: 12px; width: auto; }
    .eth-legend-list div { grid-template-columns: 30px minmax(0, 1fr); }
    .eth-legend-list div span { grid-column: 2 / 3; }
    .eth-orphan-summary { grid-template-columns: 1fr; }
}
