:root {
    --bg: #050505;
    --bar-bg: #111114;
    --text: #d4d4d8;
    --muted: #71717a;
    --prompt: #a78bfa;
    --command: #38bdf8;
    --link: #c4b5fd;
    --error: #f87171;
    --ok: #4ade80;
    --idle: #f59e0b;
    --dnd: #ef4444;
    --bar-height: 28px;
    --quickbar-height: 0px;
    --line-stagger: 30ms;
    --name: #d8ccff;
    --sun: #ffc46b;
    --stripe: #ff5fa2;
    --city: #6d28d9;
    --horizon: #f472b6;
    --floor: #22d3ee;
    --star: #8a849a;
}

/* Konami code. Gold and teal, the Radiant badge colours. */
body.radiant {
    --prompt: #ffd166;
    --command: #5eead4;
    --link: #fde68a;
    --name: #ffe7a3;
    --city: #b45309;
    --stripe: #f59e0b;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    overflow: hidden;
}

::selection {
    background: var(--prompt);
    color: var(--bg);
}

.screen {
    height: calc(100dvh - var(--bar-height) - var(--quickbar-height));
    overflow-y: auto;
    padding: 16px 20px 24px;
    cursor: text;
    scrollbar-width: thin;
    scrollbar-color: #27272a transparent;
}

.line {
    margin: 0;
    min-height: 1.5em;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    animation: line-in 160ms ease-out both;
    animation-delay: calc(var(--i, 0) * var(--line-stagger));
}

@keyframes line-in {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
}

.no-animate {
    animation: none;
}

.hero {
    display: flex;
    align-items: center;
    gap: 0 3ch;
    margin-bottom: 0.5em;
    font-size: var(--hero-size, 15px);
    line-height: 1.12;
    text-shadow: -1.5px 0 rgba(255, 40, 110, 0.5), 1.5px 0 rgba(40, 200, 255, 0.5);
}

.hero.stacked {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2em;
}

.hero pre {
    margin: 0;
    font: inherit;
    white-space: pre;
}

.hero .row {
    display: block;
    min-height: 1.12em;
}

.hero-name {
    color: var(--name);
    text-shadow: -1.5px 0 rgba(255, 40, 110, 0.75), 1.5px 0 rgba(40, 200, 255, 0.75), 0 0 14px rgba(167, 139, 250, 0.5);
}

.hero-tagline {
    display: block;
    margin-top: 0.9em;
    color: var(--muted);
    font-size: max(0.85em, 12px);
    line-height: 1.4;
    text-shadow: none;
}

.z-star { color: var(--star); }
.z-sun { color: var(--sun); }
.z-stripe { color: var(--stripe); }
.z-city { color: var(--city); }
.z-horizon { color: var(--horizon); text-shadow: 0 0 8px var(--horizon); }
.z-floor { color: var(--floor); opacity: 0.8; }

.slam {
    animation: slam 380ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
    transform-origin: left center;
}

@keyframes slam {
    from {
        transform: scale(1.06);
        filter: brightness(2.4);
        opacity: 0;
    }

    to {
        transform: none;
        filter: none;
        opacity: 1;
    }
}

/* CRT scanlines over the whole terminal. */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px);
}

.banner {
    color: var(--prompt);
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.45);
}

.muted {
    color: var(--muted);
}

.prompt {
    color: var(--prompt);
}

.command {
    color: var(--command);
    text-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

button.command {
    font: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

button.command:hover,
button.command:focus-visible {
    text-decoration: underline;
    outline: none;
}

.error {
    color: var(--error);
}

.ok {
    color: var(--ok);
}

.warn {
    color: var(--idle);
}

.gold {
    color: #ffd166;
    text-shadow: 0 0 10px rgba(255, 209, 102, 0.6);
}

.go {
    color: var(--bg);
    background: var(--ok);
}

.matrix {
    position: fixed;
    inset: 0;
    z-index: 5;
    background: var(--bg);
}

.white {
    color: #fff;
}

.accent {
    color: var(--link);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    background: var(--link);
    color: var(--bg);
    outline: none;
}

.prompt-line {
    position: relative;
    display: block;
    overflow-wrap: anywhere;
    cursor: text;
}

.typed {
    color: #fff;
    white-space: pre-wrap;
}

.cursor {
    background: var(--command);
    color: var(--bg);
    animation: blink 1s steps(1) infinite;
}

.prompt-line:not(:focus-within) .cursor {
    background: none;
    outline: 1px solid var(--command);
    outline-offset: -1px;
    color: #fff;
    animation: none;
}

@keyframes blink {
    50% {
        background: none;
        color: #fff;
    }
}

/* The real input is invisible; .typed mirrors its value so the block cursor can sit on any character.
   16px stops iOS from zooming in on focus. */
.input {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    font-size: 16px;
}

.prompt-line.busy > :not(.input) {
    opacity: 0;
}

/* Desktop visitors type, so the quick command row is for small and touch screens only. */
.quickbar {
    display: none;
}

@media (max-width: 600px), (hover: none) and (pointer: coarse) {
    :root {
        --quickbar-height: 48px;
    }

    .quickbar {
        position: fixed;
        inset: auto 0 var(--bar-height) 0;
        height: var(--quickbar-height);
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0 12px;
        overflow-x: auto;
        background: var(--bg);
        border-top: 1px solid #1f1f23;
        scrollbar-width: none;
    }
}

.quickbar button {
    flex: none;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #27272a;
    border-radius: 4px;
    background: var(--bar-bg);
    color: var(--command);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* The empty alt text keeps screen readers from reading "dollar" before each name. */
.quickbar button::before {
    content: '$ ';
    content: '$ ' / '';
    color: var(--muted);
}

.quickbar button:active {
    background: var(--command);
    color: var(--bg);
}

.quickbar button:active::before {
    color: inherit;
}

.quickbar button:focus-visible {
    outline: 1px solid var(--command);
    outline-offset: 2px;
}

.statusbar {
    position: fixed;
    inset: auto 0 0 0;
    height: var(--bar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 12px;
    background: var(--bar-bg);
    border-top: 1px solid #1f1f23;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.statusbar-session {
    color: var(--prompt);
}

.statusbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.statusbar-music {
    color: var(--ok);
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.statusbar-live,
.live {
    color: var(--stripe);
}

.statusbar-presence {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    flex: none;
}

.dot[data-status="online"] {
    background: var(--ok);
}

.dot[data-status="idle"] {
    background: var(--idle);
}

.dot[data-status="dnd"] {
    background: var(--dnd);
}

@media (max-width: 600px) {
    body {
        font-size: 13px;
    }

    .screen {
        padding: 12px 16px 20px;
    }

    .statusbar-session,
    .statusbar-clock {
        display: none;
    }

    .statusbar {
        justify-content: flex-end;
    }
}

@media (prefers-reduced-motion: reduce) {

    .line,
    .cursor,
    .slam {
        animation: none;
    }
}
