:root {
    --ontology-product: #55a7ff;
    --ontology-application: #3dd6b4;
    --ontology-theme: #b985ff;
    --ontology-industry: #f0b85b;
    --ontology-ecosystem: #ff7f9d;
    --ontology-kospi: #5f8fff;
    --ontology-kosdaq: #b276ff;
}

.company-toolbar { display:flex; gap:12px; align-items:center; flex-wrap:wrap; padding:8px 0; color:#aab8ca; font-size:12px; }
.company-toolbar label { display:flex; gap:6px; align-items:center; }
.company-toolbar [hidden] { display:none; }
.company-relation { margin:8px 0; padding:10px; border:1px solid #344356; border-radius:8px; color:#cfdae8; overflow-wrap:anywhere; }
.company-relation summary { cursor:pointer; font-size:13px; font-weight:600; }
.company-relation summary small { display:block; margin:5px 0; color:#ff9bb3; }
.company-relation p { font-size:12px; line-height:1.6; white-space:pre-wrap; }
.company-relation .ontology-inspector-action { display:inline-block; margin:4px 5px 4px 0; }
.company-evidence { padding-top:12px; margin-top:8px; border-top:1px solid #344356; }
.company-news-body { white-space:pre-wrap; overflow-wrap:anywhere; font:12px/1.65 sans-serif; max-height:400px; overflow:auto; }
.ontology-page {
    overflow: hidden;
    min-width: 320px;
}

.ontology-page .app-container {
    min-height: 100vh;
}

.ontology-header-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #8ea0b8;
    font-size: 12px;
    white-space: nowrap;
}

.ontology-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #42d4a6;
    box-shadow: 0 0 12px rgba(66, 212, 166, 0.72);
}

.ontology-shell {
    height: calc(100vh - 64px);
    padding: 14px 18px 18px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 11px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
.ontology-filter-set[hidden] { display: none; }
.ontology-layer-toggles { margin-left: auto; }

.ontology-hero {
    min-height: 66px;
    padding: 2px 2px 0;
}

.ontology-hero h1 {
    font-size: clamp(22px, 2vw, 29px);
}

.ontology-hero p {
    max-width: 720px;
}

.ontology-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(118px, 1fr));
    gap: 8px;
}

.ontology-metric {
    min-height: 54px;
    padding: 9px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(132, 153, 189, 0.13);
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(20, 29, 45, 0.92), rgba(12, 18, 30, 0.92));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.ontology-metric span {
    color: #74849b;
    font-size: 12px;
    font-weight: 650;
}

.ontology-metric strong {
    color: #eaf0fb;
    font-family: 'Fira Code', monospace;
    font-size: 19px;
    font-weight: 600;
}

.ontology-metric.metric-accent {
    border-color: rgba(76, 130, 255, 0.24);
    background: linear-gradient(145deg, rgba(33, 62, 126, 0.28), rgba(12, 20, 36, 0.94));
}

.ontology-metric.metric-accent strong { color: #8fb0ff; }

.ontology-toolbar {
    min-height: 48px;
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(135, 155, 187, 0.13);
    border-radius: 12px;
    background: rgba(13, 19, 31, 0.84);
}

.ontology-search-wrap {
    position: relative;
    width: min(280px, 27vw);
    min-width: 190px;
    height: 35px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(135, 155, 187, 0.16);
    border-radius: 9px;
    background: rgba(6, 10, 18, 0.72);
}

.ontology-search-wrap:focus-within {
    border-color: rgba(82, 132, 255, 0.58);
    box-shadow: 0 0 0 3px rgba(58, 111, 247, 0.10);
}

.ontology-search-wrap > svg {
    width: 16px;
    height: 16px;
    margin-left: 10px;
    flex: 0 0 auto;
    fill: none;
    stroke: #65758d;
    stroke-width: 1.8;
}

.ontology-search-wrap input {
    width: 100%;
    height: 100%;
    padding: 0 10px 0 8px;
    border: 0;
    outline: 0;
    color: #e5ecf8;
    background: transparent;
    font-size: 14px;
}

.ontology-search-wrap input::placeholder { color: #526177; }

.ontology-search-results {
    position: absolute;
    z-index: 40;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow: auto;
    padding: 5px;
    border: 1px solid rgba(135, 155, 187, 0.18);
    border-radius: 11px;
    background: rgba(10, 15, 25, 0.98);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.48);
}

.ontology-search-result {
    width: 100%;
    min-height: 42px;
    padding: 7px 9px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 8px;
    border: 0;
    border-radius: 8px;
    color: #dce5f3;
    text-align: left;
    background: transparent;
    cursor: pointer;
}

.ontology-search-result:hover,
.ontology-search-result:focus-visible {
    background: rgba(78, 117, 211, 0.15);
}

.ontology-search-result strong { font-size: 13px; }
.ontology-search-result code { color: #7f94ae; font-size: 11px; }
.ontology-search-result small { grid-column: 1 / -1; color: #64758b; font-size: 11px; }

.ontology-reset,
.ontology-filter {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(136, 156, 188, 0.14);
    border-radius: 8px;
    color: #76879e;
    background: rgba(255, 255, 255, 0.025);
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}

.ontology-reset {
    color: #dce6f7;
    border-color: rgba(78, 126, 244, 0.28);
    background: rgba(58, 111, 247, 0.13);
}

.ontology-reset:hover { background: rgba(58, 111, 247, 0.22); }

.ontology-filter-set {
    display: inline-flex;
    gap: 3px;
    padding-left: 7px;
    border-left: 1px solid rgba(137, 157, 190, 0.12);
}

.ontology-filter.active {
    color: #dce7f8;
    border-color: rgba(97, 139, 246, 0.28);
    background: rgba(71, 111, 213, 0.13);
}

.ontology-filter:not(.active) { opacity: 0.52; }

.ontology-workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(350px, 390px);
    gap: 11px;
}

.ontology-canvas-panel,
.ontology-inspector {
    min-height: 0;
    border: 1px solid rgba(135, 155, 187, 0.14);
    border-radius: 14px;
    background: rgba(10, 15, 25, 0.91);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.20), inset 0 1px rgba(255, 255, 255, 0.025);
}

.ontology-canvas-panel {
    overflow: hidden;
    display: grid;
    grid-template-rows: 46px minmax(0, 1fr);
}

.ontology-canvas-head {
    padding: 0 12px 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(135, 155, 187, 0.11);
    background: rgba(17, 24, 38, 0.64);
}

.ontology-canvas-head > div:first-child {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.ontology-canvas-head strong { color: #e6edf9; font-size: 14px; }
.ontology-canvas-head span { overflow: hidden; color: #71839b; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

.ontology-zoom-controls { display: flex; gap: 3px; }
.ontology-zoom-controls button {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(135, 155, 187, 0.13);
    border-radius: 7px;
    color: #8292a8;
    background: rgba(255, 255, 255, 0.025);
    font-size: 13px;
    cursor: pointer;
}
.ontology-zoom-controls button:hover { color: #dbe6f6; background: rgba(76, 115, 210, 0.13); }

.ontology-canvas-wrap {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 48%, rgba(43, 72, 136, 0.09), transparent 42%),
        linear-gradient(rgba(90, 112, 153, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(90, 112, 153, 0.025) 1px, transparent 1px),
        #080d16;
    background-size: auto, 32px 32px, 32px 32px, auto;
}

#ontology-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: none;
}

#ontology-canvas.dragging { cursor: grabbing; }
#ontology-canvas.hovering { cursor: pointer; }

.ontology-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #b9c6d9;
    background: rgba(8, 13, 22, 0.84);
    z-index: 12;
}

.ontology-loading[hidden] { display: none; }
.ontology-loading small { color: #71839a; font-size: 12px; }

.ontology-loader {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(104, 137, 209, 0.18);
    border-top-color: #5d8cff;
    border-radius: 50%;
    animation: ontologySpin 0.85s linear infinite;
}

@keyframes ontologySpin { to { transform: rotate(360deg); } }

.ontology-tooltip {
    position: absolute;
    z-index: 15;
    max-width: 240px;
    padding: 7px 9px;
    pointer-events: none;
    border: 1px solid rgba(137, 158, 192, 0.20);
    border-radius: 8px;
    color: #dfe8f7;
    background: rgba(8, 13, 22, 0.96);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
    font-size: 12.5px;
    line-height: 1.45;
}

.ontology-canvas-note {
    position: absolute;
    left: 10px;
    bottom: 8px;
    padding: 5px 8px;
    border: 1px solid rgba(131, 151, 184, 0.10);
    border-radius: 7px;
    color: #536379;
    background: rgba(7, 11, 19, 0.72);
    font-size: 11px;
    pointer-events: none;
}

.ontology-inspector {
    overflow: hidden;
    position: relative;
}

.ontology-inspector-empty {
    height: 100%;
    min-height: 260px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

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

.ontology-inspector-empty h2 { margin: 17px 0 7px; color: #d5dfed; font-size: 18px; }
.ontology-inspector-empty p { max-width: 290px; margin: 0; color: #71839a; font-size: 13px; line-height: 1.65; }

.ontology-inspector-orbit {
    position: relative;
    width: 58px;
    height: 58px;
    border: 1px solid rgba(92, 133, 238, 0.27);
    border-radius: 50%;
    box-shadow: 0 0 34px rgba(58, 111, 247, 0.12);
}
.ontology-inspector-orbit::before,
.ontology-inspector-orbit::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}
.ontology-inspector-orbit::before { inset: 15px; background: #5d8dff; box-shadow: 0 0 16px #4e78e7; }
.ontology-inspector-orbit::after { width: 8px; height: 8px; top: 4px; left: 24px; background: #b77fff; }

.ontology-inspector-content {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
}

.ontology-inspector-content[hidden] { display: none; }

.ontology-inspector-head { padding: 16px 16px 11px; border-bottom: 1px solid rgba(135, 155, 187, 0.10); }
.ontology-inspector-kicker { color: #7398ef; font-family: 'Fira Code', monospace; font-size: 11px; letter-spacing: 0.12em; }
.ontology-inspector-head h2 { margin: 5px 0 3px; color: #edf3fc; font-size: 20px; line-height: 1.3; }
.ontology-inspector-head p { margin: 0; color: #8192aa; font-size: 12px; }

.ontology-inspector-stats { padding: 9px 12px; display: flex; flex-wrap: wrap; gap: 5px; border-bottom: 1px solid rgba(135, 155, 187, 0.08); }
.ontology-stat-chip { padding: 5px 8px; border-radius: 999px; color: #9bacbf; background: rgba(104, 132, 182, 0.09); font-size: 10.5px; }
.ontology-stat-chip strong { margin-left: 3px; color: #d6e0ef; font-family: 'Fira Code', monospace; }

.ontology-inspector-actions { padding: 8px 12px; display: flex; gap: 5px; border-bottom: 1px solid rgba(135, 155, 187, 0.08); }
.ontology-inspector-action {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(87, 130, 234, 0.18);
    border-radius: 7px;
    color: #8ea8e9;
    background: rgba(63, 102, 196, 0.10);
    font-size: 11px;
    cursor: pointer;
}
.ontology-inspector-action:hover { color: #dbe6ff; background: rgba(63, 102, 196, 0.19); }
.ontology-inspector-action.active {
    color: #edf3ff;
    border-color: rgba(101, 146, 255, 0.48);
    background: rgba(70, 112, 218, 0.24);
}

.ontology-relation-list {
    min-height: 0;
    overflow: auto;
    padding: 7px;
}

.ontology-section-title {
    margin: 4px 2px 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #7f90a8;
}
.ontology-section-title:not(:first-child) { margin-top: 16px; }
.ontology-section-title strong { font-size: 11.5px; letter-spacing: 0.05em; }
.ontology-section-title span {
    min-width: 20px;
    padding: 2px 5px;
    border-radius: 999px;
    color: #9fb2cc;
    background: rgba(100, 132, 202, 0.10);
    font-family: 'Fira Code', monospace;
    font-size: 10.5px;
    text-align: center;
}

.ontology-news-section-title {
    margin: 0 0 9px;
    padding: 8px 9px;
    border: 1px solid rgba(87, 133, 241, 0.22);
    border-radius: 8px;
    color: #a9c0f6;
    background: linear-gradient(90deg, rgba(63, 103, 204, 0.16), rgba(63, 103, 204, 0.04));
}
.ontology-news-section-title strong { font-size: 13px; letter-spacing: 0.02em; }
.ontology-news-section-title span { color: #dce7ff; background: rgba(92, 137, 244, 0.20); }

.ontology-news-timeline {
    position: relative;
    margin-left: 5px;
    padding-left: 13px;
    border-left: 1px solid rgba(103, 137, 211, 0.20);
}

.ontology-news-event {
    position: relative;
    width: 100%;
    margin: 0 0 7px;
    padding: 8px 9px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(132, 153, 188, 0.10);
    border-radius: 8px;
    color: #cbd6e5;
    text-align: left;
    background: rgba(255, 255, 255, 0.018);
    cursor: pointer;
    animation: ontologyNewsIn 0.24s ease-out both;
}
.ontology-news-event::before {
    content: '';
    position: absolute;
    top: 13px;
    left: -18px;
    width: 7px;
    height: 7px;
    border: 2px solid #0b111c;
    border-radius: 50%;
    background: #6e95f2;
    box-shadow: 0 0 8px rgba(93, 141, 255, 0.45);
}
.ontology-news-event:hover,
.ontology-news-event:focus-visible {
    border-color: rgba(88, 133, 241, 0.28);
    background: rgba(71, 108, 199, 0.08);
}
.ontology-news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
}
.ontology-news-meta strong {
    overflow: hidden;
    color: #8da9ed;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ontology-news-meta time {
    flex: 0 0 auto;
    color: #596b83;
    font-family: 'Fira Code', monospace;
    font-size: 10.5px;
}
.ontology-news-message {
    display: -webkit-box;
    overflow: hidden;
    color: #b9c5d6;
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}
.ontology-news-event.expanded .ontology-news-message {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}
.ontology-news-evidence { display: flex; flex-wrap: wrap; gap: 4px; }
.ontology-news-evidence em,
.ontology-news-evidence i,
.ontology-news-evidence b {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 500;
}
.ontology-news-evidence b { color: #d2a75d; background: rgba(210, 159, 73, 0.10); }
.ontology-news-evidence em { color: #8aa8ed; background: rgba(73, 113, 211, 0.11); }
.ontology-news-evidence i { color: #9b82cb; background: rgba(155, 104, 223, 0.09); }
.ontology-section-empty {
    margin: 0 0 8px;
    padding: 12px 8px;
    border-radius: 8px;
    color: #607189;
    background: rgba(255, 255, 255, 0.015);
    font-size: 11.5px;
    line-height: 1.5;
    text-align: center;
}
.ontology-section-empty.error { color: #b17c89; }

.ontology-alias-list { display: flex; flex-wrap: wrap; gap: 5px; padding: 1px 2px 4px; }
.ontology-alias-chip {
    padding: 4px 7px;
    border: 1px solid rgba(148, 111, 211, 0.14);
    border-radius: 999px;
    color: #bba8dc;
    background: rgba(132, 88, 198, 0.08);
    font-size: 11.5px;
}
.ontology-alias-chip.muted { color: #718098; }

.ontology-concept-redirect {
    margin: 3px 2px 10px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #aec3ee;
    background: rgba(77, 118, 215, 0.11);
    font-size: 11.5px;
    line-height: 1.5;
}
.ontology-neighbor-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 1px 2px 5px; }
.ontology-neighbor {
    padding: 6px 9px;
    border: 1px solid rgba(113, 154, 236, 0.24);
    border-radius: 8px;
    color: #bfd0f3;
    background: rgba(72, 111, 207, 0.10);
    font: inherit;
    font-size: 11.5px;
    text-align: left;
    cursor: pointer;
}
.ontology-neighbor:hover, .ontology-neighbor:focus-visible {
    border-color: rgba(113, 154, 236, 0.62);
    background: rgba(72, 111, 207, 0.20);
}
.ontology-neighbor-event { border-color: rgba(196, 146, 105, 0.26); color: #d6bda5; background: rgba(157, 104, 67, 0.09); }
.ontology-concept-note { margin: 0 2px 7px; color: #8192aa; font-size: 10.5px; line-height: 1.45; }
.ontology-news-scope-note { padding: 7px 9px; border-radius: 7px; background: rgba(72, 111, 207, 0.08); }
.ontology-stock-entry {
    margin: 2px 1px 11px;
    padding: 9px 10px;
    border: 1px solid rgba(113, 154, 236, 0.25);
    border-radius: 8px;
    color: #b9cdf5;
    background: rgba(72, 111, 207, 0.10);
    font-size: 11.5px;
    line-height: 1.5;
}
.ontology-stock-path-list { display: flex; flex-direction: column; gap: 5px; }
.ontology-stock-path-card {
    padding: 2px 5px 7px;
    border: 1px solid rgba(133, 153, 185, 0.10);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.018);
}
.ontology-stock-path-card .ontology-related-stock { font-size: 12px; }
.ontology-stock-path {
    display: block;
    padding: 2px 7px;
    color: #8fa5c2;
    font-size: 10.5px;
    line-height: 1.45;
}

.ontology-chain-card {
    margin: 0 0 9px;
    padding: 7px;
    border: 1px solid rgba(255, 127, 157, 0.15);
    border-radius: 10px;
    background: rgba(255, 127, 157, 0.025);
}
.ontology-chain-card.selected {
    border-color: rgba(255, 137, 166, 0.42);
    background: rgba(255, 127, 157, 0.07);
}
.ontology-chain-title {
    width: 100%;
    padding: 4px 5px 8px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    border: 0;
    color: #e1c8d2;
    text-align: left;
    background: transparent;
    cursor: pointer;
}
.ontology-chain-title strong { font-size: 13px; }
.ontology-chain-title span { color: #806f7a; font-size: 10.5px; white-space: nowrap; }
.ontology-chain-entities { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 3px 7px; }
.ontology-chain-entity {
    padding: 3px 6px;
    border: 1px solid rgba(255, 143, 169, 0.13);
    border-radius: 6px;
    color: #c89aaa;
    background: rgba(255, 127, 157, 0.045);
    font-size: 11px;
    cursor: pointer;
}
.ontology-chain-entity:hover,
.ontology-chain-entity.selected { color: #ffe7ee; border-color: rgba(255, 143, 169, 0.40); }
.ontology-chain-relation {
    width: 100%;
    margin: 3px 0 0;
    padding: 7px 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 7px;
    border: 1px solid rgba(133, 153, 185, 0.08);
    border-radius: 7px;
    color: #c8d2df;
    text-align: left;
    background: rgba(255, 255, 255, 0.018);
    cursor: pointer;
}
.ontology-chain-relation:hover,
.ontology-chain-relation.selected { border-color: rgba(255, 139, 166, 0.31); background: rgba(255, 127, 157, 0.07); }
.ontology-chain-relation strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ontology-chain-relation span { color: #8f7883; font-size: 10.5px; }
.ontology-chain-relation small { grid-column: 1 / -1; color: #68788d; font-size: 10.5px; }
.ontology-indirect-paths {
    margin-top: 7px;
    padding: 7px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-radius: 7px;
    color: #6f7f94;
    background: rgba(51, 67, 91, 0.12);
    font-size: 10.5px;
}
.ontology-indirect-paths b { color: #9aaabd; font-size: 11px; }

.ontology-related-stock-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
}
.ontology-related-stock-grid .ontology-related-stock {
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
}
.ontology-related-stock-grid .ontology-related-stock span {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes ontologyNewsIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.ontology-relation-item {
    width: 100%;
    margin: 0 0 5px;
    padding: 8px 9px;
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    gap: 3px 7px;
    border: 1px solid rgba(133, 153, 185, 0.09);
    border-radius: 8px;
    color: #cfd9e8;
    text-align: left;
    background: rgba(255, 255, 255, 0.018);
    cursor: pointer;
}

.ontology-relation-item:hover,
.ontology-relation-item.selected { border-color: rgba(82, 128, 239, 0.28); background: rgba(69, 107, 202, 0.10); }
.ontology-relation-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--category-color, #7694ca); box-shadow: 0 0 9px color-mix(in srgb, var(--category-color, #7694ca) 60%, transparent); }
.ontology-relation-item strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.ontology-relation-item code { color: #70839d; font-size: 10.5px; }
.ontology-relation-meta { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px; color: #708198; font-size: 10.5px; }
.ontology-relation-meta span { padding: 2px 4px; border-radius: 4px; background: rgba(102, 125, 164, 0.07); }

.ontology-detail-card { margin: 3px 1px 8px; padding: 10px; border: 1px solid rgba(90, 133, 235, 0.19); border-radius: 9px; background: rgba(44, 70, 133, 0.10); }
.ontology-detail-card dl { margin: 0; display: grid; grid-template-columns: 82px 1fr; gap: 6px 8px; font-size: 10.5px; }
.ontology-detail-card dt { color: #61738c; }
.ontology-detail-card dd { margin: 0; overflow-wrap: anywhere; color: #aab8ca; }

.ontology-related-stock {
    width: 100%;
    min-height: 31px;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-radius: 7px;
    color: #bdc9da;
    background: transparent;
    font-size: 11.5px;
    cursor: pointer;
}
.ontology-related-stock:hover { color: #eef4ff; background: rgba(77, 118, 215, 0.11); }
.ontology-related-stock code { color: #70829a; font-size: 10.5px; }

.ontology-legend {
    min-height: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #65768d;
    font-size: 11px;
}
.ontology-legend > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ontology-legend p { margin: 0 0 0 auto; text-align: right; }
.legend-node { width: 7px; height: 7px; border-radius: 50%; background: #7f92ab; }
.legend-stock { background: var(--ontology-kospi); }
.legend-product { background: var(--ontology-product); }
.legend-theme { background: var(--ontology-theme); }
.legend-industry { background: var(--ontology-industry); }
.legend-ecosystem { background: var(--ontology-ecosystem); }

@media (max-width: 1180px) {
    .ontology-toolbar { flex-wrap: wrap; }
    .ontology-category-filters { flex-wrap: wrap; }
    .ontology-workspace { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 820px) {
    .ontology-page { overflow: auto; }
    .ontology-shell {
        height: auto;
        min-height: calc(100vh - var(--mobile-header-height));
        padding: 10px 10px calc(var(--mobile-nav-height) + 20px);
        display: flex;
        flex-direction: column;
    }
    .ontology-header-status { display: none; }
    .ontology-metrics { grid-template-columns: repeat(2, 1fr); }
    .ontology-metric { min-height: 46px; }
    .ontology-toolbar { flex-wrap: wrap; }
    .ontology-search-wrap { width: calc(100% - 78px); flex: 1 1 auto; }
    .ontology-filter-set { flex: 1 1 100%; padding-left: 0; border-left: 0; }
    .ontology-filter { flex: 1 1 0; }
    .ontology-workspace { display: flex; flex-direction: column; }
    .ontology-canvas-panel { height: 58vh; min-height: 420px; }
    .ontology-inspector { min-height: 320px; max-height: 62vh; }
    .ontology-legend { flex-wrap: wrap; padding: 5px 2px; }
    .ontology-legend p { flex: 1 1 100%; margin: 0; text-align: left; line-height: 1.5; }
    .ontology-canvas-note { display: none; }
}

@media (max-width: 480px) {
    .ontology-hero { min-height: 58px; }
    .ontology-metrics { gap: 6px; }
    .ontology-metric { padding: 7px 9px; }
    .ontology-metric strong { font-size: 14px; }
    .ontology-canvas-head span { display: none; }
    .ontology-canvas-panel { min-height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
    .ontology-loader { animation: none; }
    .ontology-news-event { animation: none; }
}

/* --- 등락 히트 레이어 (ONTOLOGY_HEAT_LAYER.md) --- */
.ontology-filter.heat-toggle.active {
    border-color: rgba(255, 99, 120, 0.55);
    background: linear-gradient(90deg, rgba(61, 139, 255, 0.28), rgba(92, 102, 120, 0.22) 50%, rgba(255, 77, 94, 0.30));
    color: #f3f6fb;
}
.ontology-heat-legend {
    position: absolute;
    right: 10px;
    bottom: 8px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 9px;
    border: 1px solid rgba(131, 151, 184, 0.12);
    border-radius: 7px;
    color: #9fb0c8;
    background: rgba(7, 11, 19, 0.78);
    font-size: 11.5px;
    pointer-events: none;
}
.ontology-heat-legend[hidden] { display: none; }
.ontology-heat-legend.stale { color: #d8b26a; }
.ontology-heat-scale { display: inline-flex; align-items: center; gap: 5px; }
.ontology-heat-scale i { font-style: normal; font-size: 10.5px; color: #7d8ea8; }
.ontology-heat-scale b {
    display: inline-block;
    width: 74px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #3d8bff, #5c6678 50%, #ff4d5e);
}
/* 히트 ON이면 빈 상태를 위 정렬·스크롤로 바꿔 TOP 리스트가 잘리지 않게 한다 */
.ontology-inspector-empty.has-heat {
    justify-content: flex-start;
    overflow-y: auto;
    padding-top: 22px;
}
.ontology-inspector-empty.has-heat .ontology-inspector-orbit { display: none; }
.ontology-inspector-empty.has-heat h2 { margin-top: 0; font-size: 16px; }
.ontology-heat-top { width: 100%; margin-top: 14px; text-align: left; }
.ontology-heat-top[hidden] { display: none; }
.ontology-heat-top h3 {
    margin: 12px 0 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #8fa1bb;
}
.ontology-heat-top h3 small { margin-left: 6px; font-weight: 500; color: #5d6d86; }
.ontology-heat-top-list { display: flex; flex-direction: column; gap: 4px; }
.ontology-heat-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 6px 9px;
    border: 1px solid rgba(131, 151, 184, 0.10);
    border-radius: 8px;
    background: rgba(12, 18, 29, 0.85);
    color: #d5dfed;
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}
.ontology-heat-row:hover { border-color: rgba(131, 151, 184, 0.30); }
.ontology-heat-row span { color: #7d8ea8; font-size: 11px; }
.ontology-heat-row b { font-variant-numeric: tabular-nums; }
.ontology-heat-row.up b { color: #ff6b7a; }
.ontology-heat-row.down b { color: #5f9dff; }
.ontology-heat-empty { color: #5d6d86; font-size: 12px; }
@media (max-width: 720px) {
    .ontology-heat-legend { right: 6px; bottom: 6px; font-size: 10.5px; }
}

/* Keep the name and movement together without crowding the graph. */
.ontology-concept-heat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    margin-top: 10px;
    border-radius: 7px;
    background: rgba(24, 33, 49, 0.45);
    font-size: 12px;
    color: #b9c6d8;
}
.ontology-concept-heat[hidden] { display: none; }
.ontology-concept-heat strong { font-size: 15px; }
.ontology-concept-heat .up { color: #ffabb5; }
.ontology-concept-heat .down { color: #94bdff; }
.ontology-concept-heat small { color: #8fa1bc; line-height: 1.5; }
.ontology-search-note { display: block; padding: 8px; color: #8fa1bc; }
#heat-legend-meaning { font-size: 11px; color: #aebfd6; font-weight: 500; }
#heat-legend-meaning[hidden] { display: none; }
.ontology-heat-legend { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 16px); }
@media (max-width: 820px) {
    .ontology-legend { gap: 8px 12px; }
    #heat-legend-meaning { flex-basis: 100%; }
    .ontology-search-wrap input { font-size: 13px; }
}

/* Parent-first overview; detailed graph remains one click away. */
.ontology-sector-heat-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name chg" "meta meta" "bar bar";
    row-gap: 3px;
}
.ontology-sector-heat-row strong { grid-area: name; }
.ontology-sector-heat-row span { grid-area: meta; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ontology-sector-heat-row b { grid-area: chg; }
.ontology-sector-heat-row.active { border-color: rgba(242, 246, 255, 0.55); background: rgba(28, 40, 62, 0.92); }
.ontology-sector-breadth {
    grid-area: bar;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #ff6b7a 0 var(--up), rgba(131, 151, 184, 0.25) var(--up) calc(100% - var(--down)), #5f9dff calc(100% - var(--down)) 100%);
}
.ontology-sector-list { margin-bottom: 14px; }
.ontology-sector-list .ontology-heat-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ontology-compact-details { border-top:1px solid #233046; padding:10px 0; }
.ontology-compact-details summary { cursor:pointer; color:#aab9cf; }
.ontology-compact-details summary .ontology-section-title { display:inline-flex; margin:0; width:calc(100% - 24px); }
.ontology-compact-details[open] summary { margin-bottom:10px; }
@media (max-width:700px) {
 .ontology-parent-cards { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
 .ontology-parent-grid { padding:14px; }
 .ontology-parent-card { padding:12px; }
 .ontology-parent-intro strong { font-size:17px; }
}

.ontology-parent-card { padding:14px 18px; gap:8px; }

.ontology-capture-toast {
    position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 4;
    padding: 7px 12px; border-radius: 8px; border: 1px solid rgba(131, 151, 184, 0.3);
    background: rgba(13, 19, 30, 0.96); color: #d5dfed; font-size: 12px; pointer-events: none;
    max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ontology-capture-toast[hidden] { display: none; }

.ontology-view-switch .ontology-filter { opacity: 1; color: #adbed9; }
.ontology-view-switch .ontology-filter.active { color: #eef3fb; }
