.view-source {
    display: grid;
    grid-template:
        'prelude' auto
        'content' 1fr
        'postlude' auto;
    margin: 0;
    border-radius: 3px;
    background-color: rgba(205, 205, 205, .1);
    color: var(--discovery-color);
    font-family: var(--discovery-font-family);
    font-size: 12px;
    line-height: 1.6;
    white-space: normal;
    tab-size: 4;
}
.view-source + .view-source {
    margin-top: 1px;
}

.view-source__prelude {
    grid-area: prelude;
    overflow: hidden;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}
.view-source__postlude {
    grid-area: postlude;
    overflow: hidden;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}
.view-source__content {
    grid-area: content;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 8px;
    overflow: auto;
    white-space: pre;
}

.view-source__action-buttons {
    order: 2;
    position: sticky;
    top: 0px;
    right: 0px;
    translate: 3px -3px;
    margin-left: 1ex;
    margin-bottom: -8px;
    display: flex;
    gap: 4px;
    font-family: var(--discovery-font-family);
    font-size: 12px;
    line-height: 1.6;
}
.view-source__action-buttons .view-button {
    padding: 4px 6px;
    margin: 0;
    opacity: 0.25;
    transition: .5s opacity;
    line-height: 14px;
}
.view-source__content:hover > .view-source__action-buttons .view-button {
    opacity: 1;
    transition-duration: .25s;
}
.view-source__action-buttons .view-button.copied {
    opacity: 1;
}
.view-source__action-buttons .view-button.copy::before {
    content: '';
    display: inline-block;
    vertical-align: top;
    width: 12px;
    height: 12px;
    -webkit-mask: center / 12px no-repeat url("./source-copy.svg");
    mask: center / 12px no-repeat url("./source-copy.svg");
    visibility: visible;
    background-color: currentColor;
    transition: .1s .25s;
    transition-property: scale, opacity;
}
.view-source__action-buttons .view-button::after {
    content: '';
    display: inline-block;
    vertical-align: top;
    margin-left: -12px;
    width: 12px;
    height: 12px;
    -webkit-mask: center / 16px no-repeat url("./source-copied.svg");
    mask: center / 16px no-repeat url("./source-copied.svg");
    background-color: #6a9c11;
    transition: .1s .25s;
    transition-property: scale, opacity;
}
.view-source__action-buttons .view-button.copied::before,
.view-source__action-buttons .view-button:not(.copied)::after {
    scale: 0;
    opacity: 0;
    transition-delay: 0s;
    transition-duration: .2s;
}

.view-source__lines {
    float: left;
    text-align: right;
    min-width: 3ex;
    padding-right: 1ex;
    margin-right: 1.5ex;
    border-right: 1px solid rgba(170, 170, 170, 0.4);
    color: rgba(150, 150, 150, 0.65);
    font-family: var(--discovery-monospace-font-family);
    font-size: var(--discovery-monospace-font-size, 12px);
    line-height: var(--discovery-monospace-line-height, 1.5); /* 18px */
}
.view-source__lines > span {
    display: block;
}

.view-source__source {
    flex-grow: 1;
    font-family: var(--discovery-monospace-font-family);
    font-size: var(--discovery-monospace-font-size, 12px);
    line-height: var(--discovery-monospace-line-height, 1.5); /* 18px */
    color: var(--discovery-fmt-color);
}

.view-source__source .spotlight,
.view-source__source .mark {
    --bg-color: light-dark(#f5e69a, #515143);
    --color: light-dark(#948634, #bdb06a);

    background: #f5e69a;
    background: var(--bg-color);
    background-image: linear-gradient(to right,
        light-dark(#fafafa80, transparent), 
        light-dark(#fafafa80, transparent)
    );
    color: var(--color);
    padding: 1px 1px 2px;
    margin: 0 -1px;
}
.view-source__source .mark {
    display: inline-block;
    margin-left: 0px;
    margin-right: 2px;
    padding: 3px .35em;
    font-family: var(--discovery-font-family);
    font-size: 83%;
    line-height: 1;
    border: .5px solid currentColor;
    border-color: color-mix(in srgb, currentColor 65%, var(--bg-color));
    border-radius: 4px;
    background-color: light-dark(#e4e4e4, #2b2b2b);
    background-clip: padding-box;
    text-decoration-thickness: 1px;
}
.view-source__source .mark[data-kind=none] {
    color: var(--discovery-color);
    border-color: transparent;
    background-clip: border-box;
}
.view-source__source .mark[data-kind=dot]::before {
    --dot-color: var(--color);
    content: '';
    display: inline-block;
    vertical-align: middle;
    padding: 4px;
    margin: -2px 4px 0 1px;
    font-size: 0px;
    border-radius: 4px;
    background-color: color-mix(in srgb, var(--dot-color) 85%, var(--discovery-background-color));
}
.view-source__source .mark[data-kind=dot]:empty {
    border: none;
    background-color: transparent;
    padding-left: 1px;
    padding-right: 1px;
}
.view-source__source .mark[data-kind=dot]:empty::before {
    margin-right: 1px;
}
.view-source__source .mark[data-kind=self] {
    --color: light-dark(#4c934c, #6eae6e);
}
.view-source__source .mark[data-kind=nested] {
    --color: light-dark(#96944d, #aead6e);
}
.view-source__source .mark[data-kind=total] {
    --color: light-dark(#9580bf, #aa92da);
}
.view-source__source .mark[data-prefix]:not([data-kind=dot])::before {
    content: attr(data-prefix);
    display: inline-block;
    color: color-mix(in srgb, currentColor 50%, var(--bg-color));
    padding: 0 3px 0 1px;
}
.view-source__source .mark[data-postfix]:not([data-kind=dot])::after {
    content: attr(data-postfix);
    display: inline-block;
    color: color-mix(in srgb, currentColor 50%, var(--bg-color));
}

.view-source__source .mark.inactive {
    --color: #888;
}
.view-source__source .spotlight.error,
.view-source__source .mark.error {
    --bg-color: light-dark(#ffc9c9, #603c3c);
    --color: light-dark(#bb6665, #ed9e9d);
}
.view-source__source .spotlight.def,
.view-source__source .mark.def {
    --bg-color: light-dark(#d3e7fb, #3a5066);
    --color: light-dark(#668fb8, #8cbae7);
}
.view-source__source .spotlight.ref,
.view-source__source .mark.ref {
    --bg-color: light-dark(#cee99b, #415220);
    --color: light-dark(#7a9a3b, #95ca2c);
}
.view-source__source .spotlight.global-ref,
.view-source__source .mark.global-ref {
    --bg-color: light-dark(#ffd8a3, #61492a);
    --color: light-dark(#9a7f59, #d8b381);
}

.view-source__source a.spotlight,
.view-source__source a.mark {
    position: relative;
    text-decoration-color: color-mix(in srgb, currentcolor 45%, transparent);
    text-underline-offset: 1.5px;
}
.view-source__source a.spotlight:hover,
.view-source__source a.mark:hover {
    text-decoration-color: color-mix(in srgb, currentcolor 75%, transparent);
    background-image: linear-gradient(to right,
        light-dark(transparent, #35353580), 
        light-dark(transparent, #35353580)
    );
}
.view-source__source a.mark:hover,
.view-source__source .mark.discovery-view-has-tooltip:hover {
    border-color: currentColor;
}
.view-source__source a.mark[data-kind=dot]:empty::before,
.view-source__source .mark.discovery-view-has-tooltip[data-kind=dot]:empty::before {
    outline: 1px solid color-mix(in srgb, var(--dot-color) 45%, transparent);
    outline-offset: 1px;
}
.view-source__source a.mark[data-kind=dot]:hover::before,
.view-source__source .mark.discovery-view-has-tooltip[data-kind=dot]:hover::before {
    outline-color: var(--dot-color);
}

.view-source__source .spotlight-ignore {
    background: #ddd;
    background-image: repeating-linear-gradient(-45deg,
        transparent,
        transparent 6px,
        rgba(225, 125, 0, .1) 6px,
        rgba(225, 125, 0, .1) 12px,
        transparent 12px
    );
}

.view-source__source .token {
    background: none;
}
.view-source__source .spotlight .token {
    color: inherit !important;
}
.view-source__source .token.comment,
.view-source__source .token.prolog,
.view-source__source .token.doctype,
.view-source__source .token.cdata,
.view-source__source .token.quote {
	color: var(--discovery-fmt-comment-color);
}
.view-source__source .token.punctuation {
	color: var(--discovery-fmt-punctuation-color);
}
.view-source__source .token.namespace {
	opacity: .7;
}
.view-source__source .token.boolean,
.view-source__source .token.atom {
    color: var(--discovery-fmt-atom-color);
}
.view-source__source .token.number {
    color: var(--discovery-fmt-number-color);
}
.view-source__source .token.selector,
.view-source__source .token.attr-value,
.view-source__source .token.string,
.view-source__source .token.string-2,
.view-source__source .token.char,
.view-source__source .token.builtin,
.view-source__source .token.inserted {
	color: var(--discovery-fmt-string-color);
}
.view-source__source .token.property,
.view-source__source .token.tag,
.view-source__source .token.constant,
.view-source__source .token.symbol,
.view-source__source .token.deleted,
.view-source__source .token.header {
	color: var(--discovery-fmt-property-color);
}
.view-source__source .token.regex,
.view-source__source .token.important,
.view-source__source .token.def,
.view-source__source .token.variable,
.view-source__source .token.variable-2 {
	color: var(--discovery-fmt-variable-color);
}
.view-source__source .token.keyword,
.view-source__source .token.atrule,
.view-source__source .token.link,
.view-source__source .token.url {
	color: var(--discovery-fmt-keyword-color);
}
.view-source__source .token.qualifier,
.view-source__source .token.function,
.view-source__source .token.attribute,
.view-source__source .token.attr-name,
.view-source__source .token.class-name {
	color: var(--discovery-fmt-qualifier-color);
}
/* .view-source__source .token.operator, */
.view-source__source .token.entity {
	color: var(--discovery-fmt-entity-color);
}
.view-source__source .token.image,
.view-source__source .token.type {
    color: var(--discovery-fmt-type-color);
}

.view-source__source .token.meta {
    color: var(--discovery-fmt-meta-color);
}
.view-source__source .token.negative {
    color: var(--discovery-fmt-negative-color);
    background-color: color-mix(in srgb, currentcolor 10%, transparent);
    padding: 1px 0;
}
.view-source__source .token.positive {
    color: var(--discovery-fmt-positive-color);
    background-color: color-mix(in srgb, currentcolor 10%, transparent);
    padding: 1px 0;
}

.view-source__source .token.discovery-view-name {
    background-color: var(--discovery-fmt-string-highlight-color);
    box-shadow: 0 0 0 1px var(--discovery-fmt-string-highlight-color);
    color: #6a9c11;
}
