:root {
    --bg: #050506;
    --panel-bg: rgba(14, 14, 16, 0.88);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #e8e6e3;
    --link-primary: #6eb6ff;
    --text-dim: #8a8886;
    --accent: #cfcac2;
    --mono: 'Nontrinsic Mono', 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    --sans: 'Nontrinsic Sans', 'Inter Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --condensed: 'Nontrinsic Sans Condensed', 'Inter Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color-scheme: dark;
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans Condensed";
    font-style: normal;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSansCondensed-Regular.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans Condensed";
    font-style: italic;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSansCondensed-Italic.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans Condensed";
    font-style: normal;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSansCondensed-Bold.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans Condensed";
    font-style: italic;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSansCondensed-BoldItalic.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans";
    font-style: normal;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSans-Regular.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans";
    font-style: italic;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSans-Italic.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans";
    font-style: normal;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSans-Bold.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Sans";
    font-style: italic;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicSans-BoldItalic.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Inter Display";
    font-style: normal;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/InterDisplay-Regular.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Inter Display";
    font-style: italic;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/InterDisplay-Italic.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Inter Display";
    font-style: normal;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/InterDisplay-Bold.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Inter Display";
    font-style: italic;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/InterDisplay-BoldItalic.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Mono";
    font-style: normal;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicMono-Regular.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Mono";
    font-style: italic;
    font-weight: 400;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicMono-Italic.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Mono";
    font-style: normal;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicMono-SemiBold.woff2") format("woff2");
}

@font-face {
    font-display: swap;
    font-family: "Nontrinsic Mono";
    font-style: italic;
    font-weight: 600;
    src: url("https://nontrinsic.linerly.xyz/fonts/NontrinsicMono-SemiBoldItalic.woff2") format("woff2");
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    overflow: hidden;
    font-family: var(--sans);
}

#canvas-container {
    position: fixed;
    inset: 0;
}

canvas {
    display: block;
    cursor: grab;
    touch-action: none;
}

#hud {
    position: fixed;
    top: 6em;
    left: 2em;
    z-index: 10;
    pointer-events: none;
    user-select: none;
}

#hud .title {
    font-family: 'Nontrinsic Sans Condensed', 'Inter Display', sans-serif;
    font-size: 1.2em;
    text-transform: lowercase;
    color: var(--text-dim);
    font-weight: bold;
}

#hud .count, #hud-fps {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--text-dim);
    opacity: 0.6;
    margin-top: 4px;
}

.last-updated {
    font-family: var(--sans) !important;
}

#loading-gate {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    background: radial-gradient(ellipse at center, #0c0c0e 0%, #030303 100%);
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.5s ease;
}

#loading-gate.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-gate .label {
    font-size: 1.25em;
    color: var(--text-primary);
    font-family: var(--condensed);
    font-weight: bold;
}

#loading-gate .spinner {
    width: 28px;
    height: 28px;
    animation: spin 0.9s linear infinite;
    color: white;
}

#loading-gate .spinner.hidden {
    display: none;
}

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

#loading-gate .error {
    max-width: 420px;
    text-align: center;
    font-family: var(--mono);
    font-size: 1em;
    color: #d99b7c;
    line-height: 1.6;
}

#loading-gate .error.hidden {
    display: none;
}

#loading-gate .retry-button {
    margin-top: 4px;
    padding: 8px 18px;
    border-radius: 4px;
    border: none;
    background: rgba(128, 128, 128, 0.5);
    color: var(--text-primary);
    font-size: 1em;
    font-family: var(--sans);
    cursor: pointer;
}

#loading-gate .retry-button:hover {
    background: rgba(170, 170, 170, 0.6);
}

#loading-gate .retry-button.hidden {
    display: none;
}

#entry-panel {
    position: fixed;
    bottom: 36px;
    right: 2em;
    z-index: 20;
    width: 340px;
    max-width: calc(100vw - 40px);
    background: var(--panel-bg);
    border-radius: 6px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 18px 18px 16px;
    transform: translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.22s ease;
}

#entry-panel.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 480px) and (orientation: portrait) {
    #entry-panel {
        left: 1em;
        right: 1em;
        bottom: 36px;
        width: auto;
        max-width: none;
    }
}

#entry-panel .eyebrow {
    font-family: var(--condensed);
    font-weight: bold;
    font-size: 1.25em;
    user-select: none;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#entry-panel .close-button {
    cursor: pointer;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.15s ease;
}

#entry-panel .close-button:hover {
    color: var(--text-primary);
}

#entry-panel .body-text {
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-primary);
    padding-top: 10px;
    padding-bottom: 10px;
    word-break: break-word;
    overflow-wrap: break-word;
    max-height: 40vh;
    overflow-y: auto;
    -webkit-tap-highlight-color: transparent;
    mask-image: linear-gradient(to bottom,
            transparent 0,
            black 12px,
            black calc(100% - 12px),
            transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom,
            transparent 0,
            black 12px,
            black calc(100% - 12px),
            transparent 100%);
}

#entry-panel .body-text p {
    white-space: pre-wrap;
    margin: 0 0 0.6em;
}

#entry-panel .body-text p:last-child {
    margin-bottom: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Nontrinsic Sans Condensed', 'Inter Display', sans-serif;
    margin: 0.5em 0 0.4em;
    line-height: 1.25;
}

#entry-panel .body-text h1:first-child,
#entry-panel .body-text h2:first-child,
#entry-panel .body-text h3:first-child,
#entry-panel .body-text h4:first-child,
#entry-panel .body-text h5:first-child,
#entry-panel .body-text h6:first-child {
    margin-top: 0;
}

#entry-panel .body-text a {
    color: #cfcac2;
}

#entry-panel .body-text li:nth-child(even) {
    filter: opacity(60%);
}

#entry-panel .body-text ul {
    margin-bottom: 0;
}

#entry-panel .body-text ul:not(:last-child) {
    margin-bottom: 0.7em;
}

#entry-panel .body-text pre,
#entry-panel .body-text code,
#entry-panel .body-text .obfuscated {
    font-family: var(--mono);
}

#entry-panel .body-text pre {
    padding: 0.6em;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre;
    max-width: 100%;
    background-color: #2a2a2a;
    -webkit-overflow-scrolling: touch;
}

#entry-panel .body-text code {
    white-space: pre-wrap;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    background-color: #2a2a2a;
}

#entry-panel .body-text pre code {
    font-family: inherit;
    word-break: break-word;
    white-space: pre-wrap;
    padding: 0;
    background: none;
}

#entry-panel .body-text hr {
    border-width: 1px;
    border-radius: 10px;
    filter: opacity(15%);
    margin-bottom: 0.7em;
}

#entry-panel .body-text blockquote:not(:last-child) {
    margin-bottom: -0.6em;
}

#entry-panel .body-text blockquote {
    border-left: 4px solid #818181;
    padding-left: 1.2rem;
    margin: 0;
}

#entry-panel .body-text .spoiler {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

#entry-panel .body-text .spoiler input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

#entry-panel .body-text .spoiler span {
    background-color: #1d1d1d;
    color: transparent;
    border-radius: 4px;
    white-space: pre-wrap;
    transition: color 0.3s ease, opacity 0.3s ease;
}

#entry-panel .body-text .spoiler input:checked+span {
    color: inherit;
}

#entry-panel .body-text .redacted {
    display: inline-block;
    font-weight: bold;
    background: linear-gradient(to top, rgba(30, 30, 30, 0.5), transparent), #2d2d2d;
    color: white;
    border-radius: 0.2em;
    padding: 0 0.2em;
    box-shadow: 0px 3px 3px #000000d0;
}

#entry-panel .body-text .redacted:nth-child(3n + 1) {
    transform: rotate(-2deg) translateY(-1px);
}

#entry-panel .body-text .redacted:nth-child(3n + 2) {
    transform: rotate(1.5deg) translateY(1px);
}

#entry-panel .body-text .redacted:nth-child(3n + 3) {
    transform: rotate(2.5deg) translateY(-0.5px);
}

#entry-panel .body-text .blank {
    display: inline-block;
    min-width: 3ch;
    border: none;
    border-bottom: 2px solid #888;
    background: transparent;
    color: inherit;
    font: inherit;
}

#entry-panel .body-text .emoji,
#entry-panel .body-text img.emoji {
    height: 1.25em;
    width: auto;
    vertical-align: middle;
    object-fit: contain;
    margin-top: -1px;
    margin-bottom: -1px;
    pointer-events: none;
}

#entry-panel .body-text .subtext:first-child {
    margin-top: 1.2em;
}

#entry-panel .body-text .subtext {
    font-size: 0.85em;
    filter: opacity(75%);
    margin-top: 0.75em;
    margin-bottom: 0.75em;
}

#entry-panel .body-text .subtext+p {
    margin-top: 0;
}

#entry-panel .body-text img:not(.emoji) {
    max-width: 100%;
    border-radius: 0.75rem;
    display: block;
    margin-top: 0.75rem;
}

#entry-panel .body-text audio,
#entry-panel .body-text video {
    max-width: 100%;
    border-radius: 0.75rem;
    margin-top: 0.75rem;
}

#entry-panel .body-text table {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid hsla(211, 0%, 42%, 0.51);
    border-radius: 6px;
    display: block;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 0.9em;
}

#entry-panel .body-text th {
    background-color: hsl(0, 0%, 30%);
}

#entry-panel .body-text th,
#entry-panel .body-text td {
    padding: 6px 10px;
    border: 1px solid hsla(211, 0%, 42%, 0.51);
}

#entry-panel .body-text tr:nth-child(even) {
    background-color: hsla(0, 0%, 25%, 0.75);
}

#entry-panel .body-text .hljs {
    color: #c9d1d9;
}

#entry-panel .body-text .hljs-doctag,
#entry-panel .body-text .hljs-keyword,
#entry-panel .body-text .hljs-meta .hljs-keyword,
#entry-panel .body-text .hljs-template-tag,
#entry-panel .body-text .hljs-template-variable,
#entry-panel .body-text .hljs-type,
#entry-panel .body-text .hljs-variable.language_ {
    color: #ff7b72;
}

#entry-panel .body-text .hljs-title,
#entry-panel .body-text .hljs-title.class_,
#entry-panel .body-text .hljs-title.function_ {
    color: #d2a8ff;
}

#entry-panel .body-text .hljs-attr,
#entry-panel .body-text .hljs-attribute,
#entry-panel .body-text .hljs-literal,
#entry-panel .body-text .hljs-meta,
#entry-panel .body-text .hljs-number,
#entry-panel .body-text .hljs-operator,
#entry-panel .body-text .hljs-variable,
#entry-panel .body-text .hljs-selector-attr,
#entry-panel .body-text .hljs-selector-class,
#entry-panel .body-text .hljs-selector-id {
    color: #79c0ff;
}

#entry-panel .body-text .hljs-regexp,
#entry-panel .body-text .hljs-string,
#entry-panel .body-text .hljs-meta .hljs-string {
    color: #a5d6ff;
}

#entry-panel .body-text .hljs-built_in,
#entry-panel .body-text .hljs-symbol {
    color: #ffa657;
}

#entry-panel .body-text .hljs-comment,
#entry-panel .body-text .hljs-code,
#entry-panel .body-text .hljs-formula {
    color: #8b949e;
}

#entry-panel .body-text .hljs-name,
#entry-panel .body-text .hljs-quote,
#entry-panel .body-text .hljs-selector-tag,
#entry-panel .body-text .hljs-selector-pseudo {
    color: #7ee787;
}

#entry-panel .body-text .hljs-section {
    color: #1f6feb;
    font-weight: bold;
}

#entry-panel .body-text .hljs-bullet {
    color: #f2cc60;
}

#entry-panel .body-text .hljs-emphasis {
    color: #c9d1d9;
    font-style: italic;
}

#entry-panel .body-text .hljs-strong {
    color: #c9d1d9;
    font-weight: bold;
}

#entry-panel .body-text .md-loading,
#entry-panel .body-text .md-error {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
}

#entry-panel .body-text .md-error {
    color: #d99b7c;
}

#entry-panel .uuid {
    margin-top: 12px;
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--text-dim);
    opacity: 0.55;
    word-break: break-all;
    user-select: none;
}

#hint {
    position: fixed;
    bottom: 4em;
    left: 3em;
    right: 3em;
    z-index: 10;
    font-family: var(--sans);
    font-size: 10.5px;
    color: var(--text-dim);
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
}

#hud-fps {
    text-align: right;
}

#info-right {
    position: fixed;
    display: flex;
    flex-direction: row-reverse;
    gap: 1em;
    top: 6.22em;
    right: 2em;
    z-index: 10;
}

#info-button {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.15s ease;
}

#info-button:hover {
    opacity: 0.55;
}

#info-button img {
    width: 100%;
    height: 100%;
    display: block;
    filter: invert(1) brightness(1.6);
}

#info-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3, 3, 3, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#info-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#info-dialog {
    width: 420px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: none;
    border-radius: 8px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 22px 22px 20px;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.3, 1);
}

#info-overlay.visible #info-dialog {
    transform: translateY(0) scale(1);
}

#info-dialog .eyebrow {
    font-family: var(--condensed);
    font-weight: bold;
    font-size: 1.25em;
    user-select: none;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#info-dialog .close-button {
    cursor: pointer;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.15s ease;
}

#info-dialog .close-button:hover {
    color: var(--text-primary);
}

#info-dialog .body-text {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-y: auto;
    min-height: 0;
    mask-image: linear-gradient(to bottom,
            transparent 0,
            black 12px,
            black calc(100% - 12px),
            transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom,
            transparent 0,
            black 12px,
            black calc(100% - 12px),
            transparent 100%);
}

@media(max-width:480px) {
    #hud {
        left: 1em;
    }
    #info-right {
        right: 1em;
    }
    #hint {
        left: 1.5em;
        right: 1.5em;
    }
    #hud-fps {
        right: 4.5em;
    }
}

#entry-panel .body-text::-webkit-scrollbar {
    width: 4px;
}

#entry-panel .body-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
}

a {
    color: var(--link-primary);
}

a:focus-visible,
button:focus-visible,
dialog:focus-visible {
  outline: 3px solid #e52b50;
  outline-offset: 2px;
  border-radius: 4px;
}