* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --panel: rgba(6, 7, 8, .42);
    --panel-hover: rgba(14, 13, 12, .66);
    --border: rgba(176, 163, 139, .28);
    --text: rgba(202, 195, 180, .88);
    --muted: rgba(202, 195, 180, .5);
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: "Kalkin", "Old English Text MT", "Cinzel Decorative", "UnifrakturCook", Georgia, serif;
    color: var(--text);
}

body.menu-open #introHint,
body.menu-closing #introHint {
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
}

#background {
    position: fixed;
    inset: 0;
    background-image: url("../img/background.jpg");
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #000;
    z-index: 1;
}

#overlay {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at var(--origin-x, 50%) var(--origin-y, 50%), rgba(190,176,148,.035), transparent 15%),
        rgba(0,0,0,.16);
    z-index: 2;
    transition: background .7s ease;
}

body.menu-open #overlay,
body.menu-closing #overlay {
    background:
        radial-gradient(circle at var(--origin-x, 50%) var(--origin-y, 50%), rgba(190,176,148,.075), transparent 18%),
        rgba(0,0,0,.22);
}

#city {
    position: fixed;
    inset: 0;
    z-index: 50;
    cursor: crosshair;
}

#stellaCore {
    position: fixed;
    left: var(--origin-x, 50%);
    top: var(--origin-y, 50%);
    width: 1px;
    height: 1px;
    border: 0;
    background: transparent;
    opacity: 0;
    pointer-events: none;
}

#lines {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    pointer-events: none;
}

#menu {
    position: fixed;
    inset: 0;
    z-index: 70;
    pointer-events: none;
}

.menu-card,
.core-card {
    position: fixed;
    min-height: 72px;
    display: grid;
    grid-template-columns: 42px 1fr 24px;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(18,18,17,.48), var(--panel));
    box-shadow:
        inset 12px 0 0 rgba(255,255,255,.015),
        inset 0 1px 0 rgba(255,255,255,.035);
    color: var(--text);
    text-decoration: none;
    opacity: 0;
    pointer-events: auto;
    overflow: hidden;
    transition:
        opacity .42s ease,
        transform .42s ease,
        background .25s ease,
        border-color .25s ease,
        box-shadow .25s ease;
}

.core-card {
    width: max-content;
    min-width: 250px;
    max-width: none;
    transform: translate(-50%, -50%) scale(.92);
    z-index: 2;
}

.menu-card {
    width: max-content;
    min-width: 220px;
    max-width: none;
    transform: translate(-50%, -50%) translateY(10px);
}

.menu-card::before,
.core-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(190,176,148,.055), transparent);
    opacity: 0;
    transform: translateX(-45%);
    transition: opacity .25s ease, transform .55s ease;
}

.menu-card::after,
.core-card::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(193,176,143,.88), transparent);
    transform: translateX(-105%);
    transition: transform .48s ease;
}

.menu-card.show,
.core-card.show {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) scale(1);
}

.menu-card:hover,
.menu-card:focus-visible,
.core-card:hover,
.core-card:focus-visible {
    background: var(--panel-hover);
    border-color: rgba(202,184,150,.52);
    box-shadow:
        0 0 20px rgba(190,176,148,.12),
        inset 12px 0 0 rgba(190,176,148,.025),
        inset 0 0 24px rgba(190,176,148,.045);
    outline: none;
}

.menu-card:hover::before,
.menu-card:focus-visible::before,
.core-card:hover::before,
.core-card:focus-visible::before {
    opacity: 1;
    transform: translateX(45%);
}

.menu-card:hover::after,
.menu-card:focus-visible::after,
.core-card:hover::after,
.core-card:focus-visible::after {
    transform: translateX(105%);
}

.menu-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(190,176,148,.28);
    color: rgba(202,195,180,.7);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 17px;
}

.menu-copy {
    min-width: 0;
    padding-right: 8px;
}

.menu-title {
    position: relative;
    z-index: 1;
    transform: translateY(1px);
    font-size: clamp(17px, 1.05vw, 23px);
    font-weight: 500;
    line-height: 1;
    color: var(--text);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    text-shadow: 0 0 12px rgba(190,176,148,.22);
}

.menu-sub {
    margin-top: 7px;
    font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI Condensed", Arial, sans-serif;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .9px;
    white-space: nowrap;
    overflow: visible;
}

.menu-number {
    align-self: start;
    justify-self: end;
    color: rgba(202,195,180,.34);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
}

#introHint {
    position: fixed;
    left: 50%;
    bottom: 34px;
    z-index: 100;
    transform: translateX(-50%);
    color: rgba(202,195,180,.58);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(190,176,148,.18);
    transition: opacity .35s ease, transform .35s ease;
}

#terminalHud {
    position: fixed;
    top: 26px;
    right: 28px;
    z-index: 110;
    min-width: 116px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 13px;
    border: 1px solid rgba(176, 163, 139, .24);
    background: linear-gradient(180deg, rgba(18, 18, 17, .38), rgba(6, 7, 8, .3));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
    color: rgba(202, 195, 180, .58);
    font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI Condensed", Arial, sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.8px;
    text-decoration: none;
    text-transform: uppercase;
    transition: color .25s ease, border-color .25s ease, background .25s ease, box-shadow .25s ease;
}

#terminalHud::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 1px;
    background: rgba(193, 176, 143, .72);
    transform: scaleX(0);
    transition: transform .3s ease;
}

#terminalHud:hover,
#terminalHud:focus-visible {
    color: rgba(222, 215, 199, .9);
    border-color: rgba(202, 184, 150, .48);
    background: linear-gradient(180deg, rgba(24, 23, 21, .58), rgba(8, 9, 9, .48));
    box-shadow: 0 0 18px rgba(190, 176, 148, .1), inset 0 1px 0 rgba(255, 255, 255, .04);
    outline: none;
}

#terminalHud:hover::after,
#terminalHud:focus-visible::after {
    transform: scaleX(1);
}

.terminalHudIcon {
    color: rgba(106, 146, 104, .78);
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    letter-spacing: 0;
    text-shadow: 0 0 8px rgba(72, 116, 78, .2);
}

#hud-left {
    position: fixed;
    left: 30px;
    bottom: 28px;
    z-index: 100;
    font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI Condensed", Arial, sans-serif;
    font-size: 12px;
    line-height: 22px;
    color: rgba(202,195,180,.58);
    letter-spacing: 1.6px;
    text-transform: uppercase;
    pointer-events: none;
}

#signalScope {
    display: block;
    width: 220px;
    height: 34px;
    margin-top: 7px;
    opacity: .58;
}

.statusValue {
    color: rgba(72, 116, 78, .72);
    text-shadow: 0 0 8px rgba(72, 116, 78, .16);
}

#hud-right {
    position: fixed;
    right: 8px;
    bottom: 74px;
    text-align: right;
    z-index: 100;
    pointer-events: none;
}

.mottoPlate {
    position: relative;
    width: 178px;
    padding: 12px 10px;
    border: 1px solid rgba(176,163,139,.28);
    background:
        linear-gradient(180deg, rgba(18,18,17,.44), rgba(6,7,8,.36));
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.035),
        inset 0 0 24px rgba(190,176,148,.025);
    color: rgba(202,195,180,.62);
    font-family: "Kalkin", "Old English Text MT", "Cinzel Decorative", "UnifrakturCook", Georgia, serif;
    letter-spacing: 2px;
    text-align: center;
}

.mottoPlate::before,
.mottoPlate::after {
    content: "";
    position: absolute;
    top: -1px;
    width: 22px;
    height: 22px;
    border-top: 1px solid rgba(202,184,150,.44);
}

.mottoPlate::before {
    left: -1px;
    border-left: 1px solid rgba(202,184,150,.44);
}

.mottoPlate::after {
    right: -1px;
    border-right: 1px solid rgba(202,184,150,.44);
}

.latin {
    font-size: 10px;
    font-style: italic;
    line-height: 18px;
    letter-spacing: .8px;
}

.mottoMark {
    margin-bottom: 5px;
    font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI Condensed", Arial, sans-serif;
    font-size: 10px;
    letter-spacing: 2.2px;
    color: rgba(202,195,180,.4);
}

.mottoSeal {
    margin-top: 7px;
    color: rgba(202,184,150,.48);
    font-size: 14px;
    line-height: 1;
}

.audio-toggle {
    position: fixed;
    right: 18px;
    bottom: 26px;
    z-index: 120;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 7px 10px;
    border: 1px solid rgba(176, 163, 139, .24);
    background: rgba(6, 7, 8, .52);
    color: rgba(202, 195, 180, .5);
    font: 600 8px/1 "Arial Narrow", Arial, sans-serif;
    letter-spacing: 1.5px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: color .3s ease, border-color .3s ease, background .3s ease;
}

.audio-toggle:hover,
.audio-toggle[aria-pressed="true"] {
    color: rgba(222, 215, 199, .9);
    border-color: rgba(202, 184, 150, .5);
    background: rgba(14, 13, 12, .72);
}

.audio-glyph {
    font-size: 14px;
    line-height: 1;
}

.audio-toggle[aria-pressed="true"] .audio-glyph {
    color: rgba(72, 116, 78, .95);
    text-shadow: 0 0 9px rgba(72, 116, 78, .5);
    animation: audioSpin 8s linear infinite;
}

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

@media (max-width: 900px) {
    #hud-left {
        display: none;
    }

    #hud-right {
        display: block;
        right: 12px;
        bottom: 58px;
        transform: scale(.78);
        transform-origin: right bottom;
    }

    .audio-toggle {
        right: 14px;
        bottom: 14px;
    }

    #introHint {
        bottom: 24px;
        width: calc(100% - 40px);
        letter-spacing: 2px;
    text-align: center;
        font-size: 11px;
    }

    #terminalHud {
        top: 14px;
        right: 14px;
        min-width: 0;
        height: 32px;
        padding: 0 11px;
    }
}
@media (max-width: 720px) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #background {
        background-size: cover;
        background-position: center center;
    }

    #overlay {
        background: rgba(0,0,0,.38);
    }

    body.menu-open #overlay,
    body.menu-closing #overlay {
        background: rgba(0,0,0,.46);
    }

    #city,
    #menu {
        position: relative;
        min-height: 100vh;
        inset: auto;
    }

    #city {
        cursor: default;
        padding: 88px 16px 34px;
    }

    #menu {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        pointer-events: none;
    }

    .menu-card,
    .core-card {
        position: relative;
        left: auto !important;
        top: auto !important;
        width: min(100%, 430px);
        min-width: 0;
        max-width: none;
        min-height: 66px;
        grid-template-columns: 36px 1fr 22px;
        gap: 12px;
        padding: 11px 12px;
        transform: translateY(12px) scale(.98);
    }

    .core-card {
        order: 0;
        width: min(100%, 380px);
        margin-bottom: 4px;
    }

    .menu-card.show,
    .core-card.show {
        transform: translateY(0) scale(1);
    }

    .menu-icon {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .menu-title {
        font-size: 17px;
        letter-spacing: 1px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .menu-sub {
        margin-top: 5px;
        font-size: 9px;
        letter-spacing: .6px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .menu-number {
        font-size: 9px;
    }

    #hud-left {
        display: none;
    }

    #hud-right {
        display: block;
        right: 10px;
        bottom: 54px;
        transform: scale(.68);
        transform-origin: right bottom;
    }

    #introHint {
        bottom: 24px;
        width: calc(100% - 40px);
        letter-spacing: 2px;
        text-align: center;
        font-size: 11px;
    }
}
