.sem-html {
    color: darkgray;
    font-weight: normal;
    font-size: 0.8rem;
    padding: 2px;
}

.sem-html:hover {
    color: red;
    cursor: pointer;
}

.sem-text {
    color: darkslategray;
    font-size: 0.8rem;
    font-weight: bold;
}

.sem-text:hover {
    color: #0000cd;
    cursor: pointer;
}

.text-segment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    box-sizing: border-box;
    align-self: center;
    color: #334155;
    font-size: 0.8rem;
    letter-spacing: 0;
}

.node {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    margin: 2px 3px;
    pointer-events: all;
    color: #0f172a;
    vertical-align: middle;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    background: rgba(248, 250, 252, 0.54);
    box-sizing: border-box;
    position: relative;
    gap: 6px;
    transform-origin: center;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
    will-change: background, border-color;
}

.node.node-toggle-animating {
    animation: semantic-node-toggle 0.3s ease-out var(--semantic-toggle-delay, 0ms) both;
}

.node:hover:not(:has(.node:hover)) {
    cursor: pointer;
    border-color: rgba(217, 119, 6, 0.58);
    background: rgba(254, 243, 199, 0.26);
    box-shadow: 0 8px 18px rgba(217, 119, 6, 0.08);
    z-index: 20;
}

.node:has(.node:hover) {
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(254, 243, 199, 0.16);
}

.node.class-highlight-hover {
    border-color: rgba(217, 119, 6, 0.78);
    background: rgba(254, 243, 199, 0.58);
    box-shadow: 0 5px 12px rgba(217, 119, 6, 0.12);
}

.node.class-highlight-hover:hover:not(:has(.node:hover)) {
    background: rgba(253, 230, 138, 0.72);
    border-color: rgba(217, 119, 6, 0.92);
}

.node.class-highlight-pinned {
    border-color: rgba(217, 119, 6, 0.94);
    background: rgba(253, 230, 138, 0.86);
    box-shadow: 0 4px 8px rgba(217, 119, 6, 0.18);
}

.node-name {
    display: none;
    pointer-events: none;
    height: 100%;
    font-weight: 600;
    letter-spacing: 0;
    font-size: 0.7rem;
    align-items: center;
    gap: 4px;
}

.node-collapsed .node-name {
    display: inline-flex;
    align-self: center;
    animation: semantic-node-label-enter 0.2s ease var(--semantic-toggle-delay, 0ms) both;
}

.node-field {
    color: var(--semantic-field, #b45309);
}

.node-type {
    color: var(--semantic-type, #2563eb);
}

.node-separator {
    color: #94a3b8;
    font-weight: 500;
}

.node-collapsed {
    background: rgba(248, 250, 252, 0.92) !important;
    border-color: rgba(148, 163, 184, 0.48);
    color: #334155;
}

.node-collapsed .text-segment {
    color: #334155;
}

.node-collapsed[data-type]:not([data-field]) {
    background: rgba(239, 246, 255, 0.9) !important;
    border-color: rgba(37, 99, 235, 0.38);
}

.node-collapsed[data-field] {
    background: rgba(255, 251, 235, 0.92) !important;
    border-color: rgba(180, 83, 9, 0.42);
}

.node-collapsed.class-highlight-hover {
    background: var(--semantic-highlight-bg, rgba(254, 243, 199, 0.7)) !important;
    border-color: var(--semantic-highlight-border, rgba(217, 119, 6, 0.24));
}

.node-collapsed.class-highlight-pinned {
    background: var(--semantic-pinned-bg, rgba(253, 230, 138, 0.92)) !important;
    border-color: var(--semantic-pinned-border, rgba(217, 119, 6, 0.34));
}

.node-collapsed.class-highlight-pinned .text-segment {
    color: #334155;
}

.node-collapsed.class-highlight-pinned .node-separator {
    color: #64748b;
}

.node-holder {
    pointer-events: none;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 4px;
    height: 100%;
    opacity: 1;
}

.node-collapsed .node-holder {
    display: none;
}

.node-expanding > .node-holder {
    animation: semantic-node-holder-enter 0.22s ease-out var(--semantic-toggle-delay, 0ms) both;
}

.break {
    flex-basis: 100%;
    height: 10px;
}

.node[data-tooltip]:not(.node-collapsed):before {
    display: none;
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    opacity: 0;
    max-width: 320px;
    padding: 6px 10px;
    pointer-events: none;
    transition: opacity 0.25s ease;
    font: 10px/1.4 'Menlo', 'Consolas', 'Ubuntu Mono', 'source-code-pro', monospace;
    background: rgba(30, 64, 175, 0.95);
    color: white;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
    transform: translateY(-4px);
    transition-delay: 0s;
    visibility: hidden;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node[data-tooltip]:hover:not(:has(.node:hover)):not(.node-collapsed):hover:before {
    opacity: 1;
    z-index: 3;
    transform: translateY(0);
    transition-delay: var(--semantic-tooltip-delay);
    visibility: visible;
}

.node-collapsed[data-tooltip]:after {
    display: none;
    content: attr(data-semantic);
    position: absolute;
    opacity: 0;
    top: calc(100% + 10px);
    left: 0;
    max-width: 420px;
    width: max-content;
    padding: 12px;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease;
    color: #1f2933;
    font: 10px/1.5 'Menlo', 'Consolas', 'Ubuntu Mono', 'source-code-pro', monospace;
    background-color: #ffffff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    transition-delay: 0s;
    visibility: hidden;
}

.node-collapsed[data-tooltip]:hover:after {
    opacity: 1;
    z-index: 3;
    transition-delay: var(--semantic-tooltip-delay);
    visibility: visible;
}

.node-collapsed[data-tooltip]:hover {
    z-index: 25;
}

@keyframes semantic-node-toggle {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
    35% {
        box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.18);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

@keyframes semantic-node-label-enter {
    from {
        opacity: 0;
        transform: translateY(1px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes semantic-node-holder-enter {
    from {
        opacity: 0;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .node,
    .node.node-toggle-animating,
    .node-expanding > .node-holder,
    .node-collapsed .node-name {
        animation: none;
    }

    .node,
    .node-holder {
        transition: none;
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .sem-html {
        color: #64748b;
    }

    :root:not([data-theme]) .sem-text,
    :root:not([data-theme]) .text-segment,
    :root:not([data-theme]) .node {
        color: #d6e0ee;
    }

    :root:not([data-theme]) .node {
        border-color: rgba(86, 95, 112, 0.72);
        background: #171a21;
    }

    :root:not([data-theme]) .node:hover:not(:has(.node:hover)) {
        border-color: rgba(225, 154, 95, 0.7);
        background: rgba(58, 40, 26, 0.42);
        box-shadow: none;
    }

    :root:not([data-theme]) .node:has(.node:hover) {
        border-color: rgba(225, 154, 95, 0.28);
        background: rgba(58, 40, 26, 0.16);
        box-shadow: none;
    }

    :root:not([data-theme]) .node.class-highlight-hover,
    :root:not([data-theme]) .node.class-highlight-hover:hover:not(:has(.node:hover)) {
        border-color: rgba(225, 154, 95, 0.86);
        background: rgba(91, 54, 42, 0.66);
        box-shadow: 0 0 0 1px rgba(225, 154, 95, 0.18);
    }

    :root:not([data-theme]) .node.class-highlight-pinned {
        border-color: rgba(242, 177, 121, 0.96);
        background: rgba(113, 63, 38, 0.82);
        box-shadow: 0 0 0 1px rgba(242, 177, 121, 0.24);
    }

    :root:not([data-theme]) .node-collapsed {
        background: #74431f !important;
        border-color: #e19a5f;
    }

    :root:not([data-theme]) .node-collapsed.class-highlight-hover {
        background: #8a4b24 !important;
        border-color: #f2b179;
    }

    :root:not([data-theme]) .node-collapsed.class-highlight-pinned {
        background: #9f5a25 !important;
        border-color: #f5c18d;
    }

    :root:not([data-theme]) .node-collapsed .text-segment,
    :root:not([data-theme]) .node-collapsed .node-field,
    :root:not([data-theme]) .node-collapsed .node-type {
        color: #fff7ed;
    }
}

:root[data-theme="dark"] .sem-html {
    color: #64748b;
}

:root[data-theme="dark"] .sem-text,
:root[data-theme="dark"] .text-segment,
:root[data-theme="dark"] .node {
    color: #d6e0ee;
}

:root[data-theme="dark"] .node {
    border-color: rgba(86, 95, 112, 0.72);
    background: #171a21;
}

:root[data-theme="dark"] .node:hover:not(:has(.node:hover)) {
    border-color: rgba(225, 154, 95, 0.7);
    background: rgba(58, 40, 26, 0.42);
    box-shadow: none;
}

:root[data-theme="dark"] .node:has(.node:hover) {
    border-color: rgba(225, 154, 95, 0.28);
    background: rgba(58, 40, 26, 0.16);
    box-shadow: none;
}

:root[data-theme="dark"] .node.class-highlight-hover,
:root[data-theme="dark"] .node.class-highlight-hover:hover:not(:has(.node:hover)) {
    border-color: rgba(225, 154, 95, 0.86);
    background: rgba(91, 54, 42, 0.66);
    box-shadow: 0 0 0 1px rgba(225, 154, 95, 0.18);
}

:root[data-theme="dark"] .node.class-highlight-pinned {
    border-color: rgba(242, 177, 121, 0.96);
    background: rgba(113, 63, 38, 0.82);
    box-shadow: 0 0 0 1px rgba(242, 177, 121, 0.24);
}

:root[data-theme="dark"] .node-collapsed {
    background: #74431f !important;
    border-color: #e19a5f;
}

:root[data-theme="dark"] .node-collapsed.class-highlight-hover {
    background: #8a4b24 !important;
    border-color: #f2b179;
}

:root[data-theme="dark"] .node-collapsed.class-highlight-pinned {
    background: #9f5a25 !important;
    border-color: #f5c18d;
}

:root[data-theme="dark"] .node-collapsed .text-segment,
:root[data-theme="dark"] .node-collapsed .node-field,
:root[data-theme="dark"] .node-collapsed .node-type {
    color: #fff7ed;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .node-collapsed {
        background: #1c2028 !important;
        border-color: rgba(86, 95, 112, 0.74);
    }

    :root:not([data-theme]) .node-collapsed[data-type]:not([data-field]) {
        background: rgba(32, 43, 62, 0.86) !important;
        border-color: rgba(138, 180, 248, 0.42);
    }

    :root:not([data-theme]) .node-collapsed[data-field] {
        background: rgba(55, 39, 24, 0.86) !important;
        border-color: rgba(214, 164, 95, 0.48);
    }

    :root:not([data-theme]) .node-collapsed.class-highlight-hover {
        background: var(--semantic-highlight-bg, rgba(120, 80, 38, 0.34)) !important;
        border-color: var(--semantic-highlight-border, rgba(232, 174, 105, 0.34));
    }

    :root:not([data-theme]) .node-collapsed.class-highlight-pinned {
        background: var(--semantic-pinned-bg, rgba(139, 88, 38, 0.48)) !important;
        border-color: var(--semantic-pinned-border, rgba(242, 190, 128, 0.44));
    }

    :root:not([data-theme]) .node-collapsed .text-segment {
        color: #d7dce4;
    }

    :root:not([data-theme]) .node-field,
    :root:not([data-theme]) .node-collapsed .node-field {
        color: var(--semantic-field, #d6a45f);
    }

    :root:not([data-theme]) .node-type,
    :root:not([data-theme]) .node-collapsed .node-type {
        color: var(--semantic-type, #8ab4f8);
    }

    :root:not([data-theme]) .node-separator {
        color: #7f8ca3;
    }
}

:root[data-theme="dark"] .node-collapsed {
    background: #1c2028 !important;
    border-color: rgba(86, 95, 112, 0.74);
}

:root[data-theme="dark"] .node-collapsed[data-type]:not([data-field]) {
    background: rgba(32, 43, 62, 0.86) !important;
    border-color: rgba(138, 180, 248, 0.42);
}

:root[data-theme="dark"] .node-collapsed[data-field] {
    background: rgba(55, 39, 24, 0.86) !important;
    border-color: rgba(214, 164, 95, 0.48);
}

:root[data-theme="dark"] .node-collapsed.class-highlight-hover {
    background: var(--semantic-highlight-bg, rgba(120, 80, 38, 0.34)) !important;
    border-color: var(--semantic-highlight-border, rgba(232, 174, 105, 0.34));
}

:root[data-theme="dark"] .node-collapsed.class-highlight-pinned {
    background: var(--semantic-pinned-bg, rgba(139, 88, 38, 0.48)) !important;
    border-color: var(--semantic-pinned-border, rgba(242, 190, 128, 0.44));
}

:root[data-theme="dark"] .node-collapsed .text-segment {
    color: #d7dce4;
}

:root[data-theme="dark"] .node-field,
:root[data-theme="dark"] .node-collapsed .node-field {
    color: var(--semantic-field, #d6a45f);
}

:root[data-theme="dark"] .node-type,
:root[data-theme="dark"] .node-collapsed .node-type {
    color: var(--semantic-type, #8ab4f8);
}

:root[data-theme="dark"] .node-separator {
    color: #7f8ca3;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .node-collapsed[data-tooltip]:after {
        color: #d7dce4;
        background: #1f2229;
        border-color: rgba(86, 95, 112, 0.9);
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.36);
    }
}

:root[data-theme="dark"] .node-collapsed[data-tooltip]:after {
    color: #d7dce4;
    background: #1f2229;
    border-color: rgba(86, 95, 112, 0.9);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.36);
}
