:root {
    --bg: #000;
    --matrix: #00ff00;
    --matrix-head: #d6ffd6;
    --font: "Share Tech Mono", Consolas, "Courier New", monospace;
    --cursor: url("../cursor.svg") 12 12, crosshair;
}

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

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--matrix);
    font-family: var(--font);
    touch-action: none;
    cursor: none;
}

body {
    overflow: hidden;
}

body.is-hud-open {
    cursor: var(--cursor);
}

body.is-hud-open #matrix,
body.is-hud-open #matrix-fx {
    cursor: var(--cursor);
}

body.is-calm {
    touch-action: manipulation;
}

#matrix,
#matrix-fx {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: none;
}

#matrix {
    z-index: 0;
    background: var(--bg);
}

#matrix-fx {
    z-index: 1;
    background: transparent;
    pointer-events: none;
}

.brand {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    text-align: center;
}

.brand.is-gone,
.brand.is-disabled {
    visibility: hidden;
}

.brand.is-assembling .brand__char {
    opacity: 0;
}

.brand__name {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: 0;
    transform: translate(-50%, -50%);
    font-family: var(--font);
    font-size: clamp(1.7rem, 7vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.34em;
    line-height: 1;
    color: var(--matrix);
    white-space: nowrap;
    text-indent: 0.34em;
    text-transform: uppercase;
    text-shadow:
        0 0 2px #00ff00,
        0 0 18px rgba(0, 255, 0, 0.4);
    mix-blend-mode: screen;
}

.brand__char {
    display: inline-block;
    min-width: 0.5em;
    color: #00e600;
}

.brand__char:nth-child(odd) {
    color: var(--matrix-head);
}

.hud-hint {
    position: fixed;
    z-index: 3;
    right: 14px;
    bottom: 14px;
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: rgba(0, 255, 0, 0.35);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.is-hud-open .hud-hint {
    opacity: 0;
}

.hud {
    position: fixed;
    z-index: 4;
    right: 12px;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    max-width: calc(100vw - 24px);
    pointer-events: auto;
}

.hud[hidden] {
    display: none !important;
}

.hud__btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: grid;
    place-content: center;
    border: 1px solid rgba(0, 255, 0, 0.35);
    background: rgba(0, 0, 0, 0.78);
    color: var(--matrix);
    cursor: pointer;
    font-family: var(--font);
}

.hud__btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.hud__btn:hover {
    border-color: var(--matrix);
    background: rgba(0, 32, 0, 0.9);
    color: var(--matrix-head);
}

.hud__btn:focus-visible {
    outline: 1px solid var(--matrix);
    outline-offset: 2px;
}

.hud__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.hud__btn--toggle[aria-pressed="false"] {
    color: rgba(0, 255, 0, 0.4);
    border-color: rgba(0, 255, 0, 0.2);
}

.hud__btn--toggle .icon-off {
    display: none;
}

.hud__btn--toggle[aria-pressed="false"] .icon-on {
    display: none;
}

.hud__btn--toggle[aria-pressed="false"] .icon-off {
    display: block;
}

.noscript {
    min-height: 100dvh;
    display: grid;
    place-content: center;
    font-size: clamp(1.7rem, 7vw, 4rem);
    letter-spacing: 0.34em;
}
