/* ===== V2 CORPORATE TERMINAL SHELL ===== */
:root {
    --bg: #020800;
    --panel-bg: rgba(0, 18, 0, 0.78);
    --panel-bg-strong: rgba(0, 28, 0, 0.9);
    --phosphor: #39ff14;
    --phosphor-dim: #1d7f0c;
    --phosphor-glow: #6dff4a;
    --amber: #ffad00;
    --amber-dim: #8a5f00;
    --red: #ff3030;
    --cyan: #31f5b5;
    --line: rgba(57, 255, 20, 0.45);
    --line-strong: rgba(57, 255, 20, 0.8);
    --panel-corner: 16px;
}

body {
    background:
        radial-gradient(circle at 50% 0%, rgba(57, 255, 20, 0.08), transparent 30%),
        linear-gradient(180deg, #010300 0%, var(--bg) 52%, #000 100%);
}

.terminal-shell {
    padding: 16px;
    background:
        linear-gradient(rgba(57, 255, 20, 0.025) 50%, rgba(0, 0, 0, 0.045) 50%),
        radial-gradient(ellipse at center, rgba(57, 255, 20, 0.05), transparent 68%);
    background-size: 100% 3px, 100% 100%;
}

.screen-content {
    --shell-left-col: clamp(160px, 13.3vw, 231px);
    --shell-right-col: clamp(160px, 13.3vw, 231px);
    --shell-main-col: minmax(420px, 1fr);
    --shell-gap: 12px;
    --side-card-pad-y: clamp(5px, 0.75vh, 8px);
    --side-heading-gap: clamp(3px, 0.55vh, 6px);
    --side-overview-row: minmax(0, 0.96fr);
    --side-signal-row: minmax(0, 0.72fr);
    --side-actions-row: minmax(0, 1.62fr);
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    display: grid;
    /* Header row sizes to content so the status chips can never clip into
       the terminal body (they wrap and the row grows instead). */
    grid-template-rows: auto minmax(0, 1fr) 68px;
    gap: var(--shell-gap);
    opacity: 1;
    transform: translateZ(0);
}

.header-bar,
.terminal-body,
.command-bar {
    min-width: 0;
}

.terminal-header {
    height: auto;
    display: grid;
    grid-template-columns: var(--shell-left-col) var(--shell-main-col) var(--shell-right-col);
    gap: var(--shell-gap);
    margin: 0;
}

.header-panel,
.ares-wordmark,
.menu-panel,
.content-panel,
.system-sidebar,
.command-bar,
.side-card {
    position: relative;
    border: 1px solid var(--line);
    background:
        linear-gradient(135deg, rgba(57, 255, 20, 0.08), transparent 16px),
        linear-gradient(180deg, var(--panel-bg-strong), rgba(0, 8, 0, 0.86));
    clip-path: none;
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.08), 0 0 12px rgba(57, 255, 20, 0.07);
}

.header-panel::before,
.ares-wordmark::before,
.menu-panel::before,
.content-panel::before,
.system-sidebar::before,
.command-bar::before {
    content: "";
    position: absolute;
    inset: 9px;
    border: 1px solid rgba(57, 255, 20, 0.08);
    pointer-events: none;
}

.header-panel {
    grid-column: 1 / 3;
    height: 100%;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) clamp(180px, 18vw, 250px);
    gap: 18px;
    align-items: center;
}

.ares-mark {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--phosphor);
    background: rgba(57, 255, 20, 0.045);
    clip-path: none;
}

.ares-mark pre {
    font: 700 10px/0.95 var(--terminal-font);
    text-align: center;
    text-shadow: 0 0 4px rgba(57, 255, 20, 0.46);
}

.header-primary {
    min-width: 0;
}

.system-title {
    font-size: clamp(24px, 2.2vw, 44px);
    line-height: 1;
    letter-spacing: 0.08em;
    white-space: nowrap;
    color: var(--phosphor);
    text-shadow: 0 0 5px rgba(57, 255, 20, 0.46);
}

.status-bar {
    margin-top: clamp(6px, 1.2vh, 12px);
    display: flex;
    flex-wrap: wrap;
    gap: clamp(4px, 0.45vw, 8px);
}

.status-item {
    min-height: clamp(22px, 2.8vh, 30px);
    padding: 4px clamp(6px, 0.8vw, 14px);
    border: 1px solid var(--line);
    background: rgba(57, 255, 20, 0.06);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--phosphor);
    font-size: clamp(9px, 0.66vw, 12px);
    line-height: 1;
    letter-spacing: 0.04em;
}

.status-button {
    font-family: var(--terminal-font);
    cursor: pointer;
    appearance: none;
}

.status-toggle {
    border-radius: 0;
    text-transform: uppercase;
}

.status-button:hover,
.status-button:focus-visible {
    border-color: var(--amber);
    background: rgba(255, 173, 0, 0.08);
    color: var(--amber);
    outline: none;
}

.status-button:hover span,
.status-button:focus-visible span {
    color: var(--amber);
}

.status-item span {
    color: var(--phosphor);
}

.status-dot {
    position: relative;
    animation: statusLightPulse 3.2s ease-in-out infinite;
}

.status-dot.warn {
    animation-name: statusLightPulseAmber;
}

.status-dot.err,
.status-item.offline .status-dot {
    animation-name: statusLightPulseRed;
}

.status-item.offline,
.status-item.offline span {
    color: var(--red);
    border-color: rgba(255, 48, 48, 0.55);
}

@keyframes statusLightPulse {
    0%, 100% { box-shadow: 0 0 3px rgba(57, 255, 20, 0.68); opacity: 0.86; }
    50% { box-shadow: 0 0 7px rgba(57, 255, 20, 0.92); opacity: 1; }
}

@keyframes statusLightPulseAmber {
    0%, 100% { box-shadow: 0 0 3px rgba(255, 173, 0, 0.62); opacity: 0.86; }
    50% { box-shadow: 0 0 7px rgba(255, 173, 0, 0.9); opacity: 1; }
}

@keyframes statusLightPulseRed {
    0%, 100% { box-shadow: 0 0 3px rgba(255, 48, 48, 0.62); opacity: 0.78; }
    50% { box-shadow: 0 0 7px rgba(255, 48, 48, 0.92); opacity: 1; }
}

.header-info {
    justify-self: end;
    min-width: 170px;
    padding-left: 16px;
    border-left: 1px solid rgba(57, 255, 20, 0.24);
    color: var(--phosphor);
    font-size: clamp(12px, 1vw, 15px);
    line-height: 1.75;
    letter-spacing: 0.05em;
}

.header-info .hl {
    color: var(--amber);
}

.ares-wordmark {
    grid-column: 3;
    width: auto;
    height: 100%;
    padding: 6px 7px;
    display: grid;
    place-items: center;
    text-align: center;
    overflow: hidden;
    min-height: 104px;
}

.ares-wordmark-svg {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 96px;
    color: var(--amber);
    overflow: visible;
    filter: drop-shadow(0 0 3px rgba(255, 173, 0, 0.38));
}

.ares-wordmark-grid path,
.ares-emblem path {
    fill: none;
    stroke: currentColor;
    vector-effect: non-scaling-stroke;
}

.ares-wordmark-grid path {
    stroke-width: 0.7;
    opacity: 0.18;
}

.ares-emblem-core {
    stroke-width: 2.1;
    opacity: 0.92;
}

.ares-emblem-rake {
    stroke-width: 0.9;
    opacity: 0.56;
}

.ares-emblem-lines {
    stroke-width: 0.8;
    opacity: 0.34;
}

.ares-wordmark-main,
.ares-wordmark-sub {
    font-family: var(--terminal-font);
    fill: currentColor;
    text-anchor: start;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.72);
}

.ares-wordmark-main {
    font-size: 35px;
    font-weight: 800;
    letter-spacing: 0.14em;
    stroke-width: 1.1px;
}

.ares-wordmark-sub {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    opacity: 0.82;
    stroke-width: 0.7px;
}

.ares-wordmark-scan {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 1;
    opacity: 0.25;
    transform-origin: center;
    vector-effect: non-scaling-stroke;
    animation: aresWordmarkScan 5.8s linear infinite;
}

.ares-wordmark-svg .ares-emblem-core,
.ares-wordmark-svg .ares-wordmark-main {
    animation: aresWordmarkGlow 4.6s ease-in-out infinite;
}

@keyframes aresWordmarkScan {
    0% { transform: translateY(-12px); opacity: 0; }
    12% { opacity: 0.22; }
    50% { opacity: 0.36; }
    100% { transform: translateY(72px); opacity: 0; }
}

@keyframes aresWordmarkGlow {
    0%, 100% { opacity: 0.84; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ares-wordmark-scan,
    .ares-wordmark-svg .ares-emblem-core,
    .ares-wordmark-svg .ares-wordmark-main {
        animation: none;
    }
}

.terminal-body {
    display: grid;
    grid-template-columns: var(--shell-left-col) var(--shell-main-col) var(--shell-right-col);
    gap: var(--shell-gap);
    min-height: 0;
}

.sidebar-left,
.main-panel {
    min-width: 0;
}

.menu-panel {
    width: auto;
    height: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 2px;
    min-height: 0;
    /* The items size themselves to the viewport (see .menu-item height), so
       a scrollbar should never appear; hide it if extreme sizes force one. */
    scrollbar-width: none;
}

.menu-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.menu-title,
.menu-section-title {
    padding: 2px 6px 4px;
    color: var(--phosphor);
    font-size: clamp(9px, 0.68vw, 11px);
    letter-spacing: 0.08em;
    opacity: 0.8;
    flex-shrink: 0;
}

.menu-section-title {
    margin-top: 3px;
    border-top: 1px solid rgba(57, 255, 20, 0.2);
    padding-top: 4px;
}

.menu-item {
    position: relative;
    /* Fit all 12 items + 3 section titles + footer without scrolling at any
       window height: shrink rows as the viewport gets shorter. */
    min-height: clamp(17px, calc((var(--viewport-height) - 360px) / 12), 30px);
    height: clamp(17px, calc((var(--viewport-height) - 360px) / 12), 30px);
    width: 100%;
    padding: 0 22px 0 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--phosphor);
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    text-align: left;
    font-size: clamp(9px, 0.7vw, 11px);
    letter-spacing: 0.04em;
    clip-path: none;
    box-sizing: border-box;
    transition: background-color 0.16s var(--ui-ease), border-color 0.16s var(--ui-ease), color 0.16s var(--ui-ease), box-shadow 0.16s var(--ui-ease);
}

.menu-item::after {
    content: "›";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    color: var(--phosphor-glow);
}

.menu-item .icon {
    width: 22px;
    color: currentColor;
    font-size: 17px;
    text-align: center;
}

.menu-item:hover,
.menu-item:focus-visible {
    border-color: var(--line);
    background: rgba(57, 255, 20, 0.07);
    outline: none;
}

.menu-item.selected {
    border-color: var(--line-strong);
    background: linear-gradient(90deg, rgba(57, 255, 20, 0.18), rgba(57, 255, 20, 0.05));
    color: var(--phosphor-glow);
    transform: none;
    box-shadow:
        inset 3px 0 0 rgba(57, 255, 20, 0.9),
        inset 0 0 0 1px rgba(57, 255, 20, 0.28);
}

.menu-item.selected::after {
    opacity: 1;
}

.menu-item.admin-cmd.locked {
    opacity: 0.42;
}

.menu-item.elevated-cmd:not(.locked) {
    color: var(--amber);
}

.menu-item.elevated-cmd:not(.locked) .icon {
    color: var(--amber);
}

.menu-item.admin-only-cmd:not(.locked) {
    color: var(--red);
}

.admin-badge {
    margin-top: 4px;
    border: 1px solid var(--amber-dim);
    color: var(--amber);
    background: rgba(255, 173, 0, 0.08);
    padding: 3px 6px;
    font-size: clamp(8px, 0.58vw, 10px);
    line-height: 1.1;
    flex: 0 0 auto;
}

.admin-badge.active {
    display: block;
}

.menu-footer {
    margin-top: auto;
    padding: 4px 6px 0;
    border-top: 1px solid rgba(57, 255, 20, 0.2);
    color: rgba(57, 255, 20, 0.72);
    font-size: clamp(8px, 0.62vw, 10px);
    line-height: 1.2;
}

.content-panel {
    min-width: 0;
    min-height: 0;
    padding: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.content-toolbar {
    min-height: 42px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 34px);
    border-bottom: 1px solid rgba(57, 255, 20, 0.28);
    background: rgba(0, 28, 0, 0.38);
    color: var(--phosphor);
    font-size: var(--font-size-small);
    letter-spacing: 0.04em;
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.security-glyph {
    color: var(--phosphor-glow);
}

.database-slot-controls {
    display: flex;
    gap: 6px;
}

.database-slot-button {
    width: 25px;
    height: 25px;
    border: 1px solid var(--red);
    color: var(--red);
    background: rgba(255, 48, 48, 0.06);
}

.database-slot-button.loaded {
    border-color: var(--phosphor);
    color: var(--phosphor);
    background: rgba(57, 255, 20, 0.1);
}

.content-brand {
    margin: 14px 16px 0;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    border-top: 1px solid rgba(57, 255, 20, 0.25);
    border-bottom: 1px solid rgba(57, 255, 20, 0.25);
    background:
        linear-gradient(90deg, transparent, rgba(57, 255, 20, 0.06), transparent),
        repeating-linear-gradient(0deg, transparent 0 11px, rgba(57, 255, 20, 0.035) 12px);
}

.brand-sigil {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--phosphor);
    font-size: 64px;
    clip-path: none;
}

.brand-name {
    color: var(--phosphor);
    font-size: clamp(25px, 3vw, 52px);
    line-height: 1;
    letter-spacing: 0.22em;
}

.brand-motto {
    margin-top: 12px;
    color: rgba(57, 255, 20, 0.72);
    letter-spacing: 0.38em;
    text-align: center;
}

.content-viewport {
    margin: 14px 16px 14px;
    min-height: 0;
    overflow: hidden;
}

.content-area {
    position: absolute;
    inset: 0;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    font-size: clamp(13px, 0.9vw, 16px);
    line-height: 1.24;
}

.output {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    color: var(--phosphor);
}

.system-sidebar {
    padding: 0;
    display: grid;
    grid-template-rows: var(--side-overview-row) var(--side-signal-row) var(--side-actions-row);
    overflow-x: hidden;
    overflow-y: hidden;
    overflow-y: clip;
    min-height: 0;
    max-height: 100%;
    scrollbar-width: none;
}

.system-sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.facility-overview-card {
    overflow: hidden;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 6px;
}

.side-card {
    border-width: 0 0 1px;
    clip-path: none;
    box-shadow: none;
    padding: var(--side-card-pad-y) 10px;
    background: rgba(0, 18, 0, 0.42);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.side-card h2 {
    margin: 0 0 var(--side-heading-gap);
    color: var(--phosphor);
    font-size: clamp(10px, 0.72vw, 12px);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.08;
}

.mini-wireframe {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    border: 1px solid rgba(57, 255, 20, 0.25);
    background:
        linear-gradient(rgba(57, 255, 20, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(57, 255, 20, 0.05) 1px, transparent 1px);
    background-size: 18px 18px;
    color: inherit;
    font: inherit;
    text-align: inherit;
    overflow: hidden;
    cursor: default;
    contain: paint;
    isolation: isolate;
}

.bre-site-indicators {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    min-width: 0;
}

.bre-site-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 18px;
    padding: 2px 3px;
    border: 1px solid rgba(255, 64, 64, 0.45);
    color: rgba(255, 116, 96, 0.86);
    background: rgba(58, 0, 0, 0.34);
    font-size: clamp(8px, 0.58vw, 10px);
    line-height: 1;
    letter-spacing: 0.03em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: inset 0 0 8px rgba(255, 0, 40, 0.08);
    transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.bre-site-indicator.online {
    border-color: rgba(57, 255, 20, 0.72);
    color: var(--phosphor);
    background: rgba(0, 48, 0, 0.5);
    box-shadow: inset 0 0 10px rgba(57, 255, 20, 0.16), 0 0 10px rgba(57, 255, 20, 0.12);
}

.projection-frame {
    background:
        radial-gradient(circle at 50% 46%, rgba(57, 255, 20, 0.12), transparent 55%),
        linear-gradient(rgba(57, 255, 20, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(57, 255, 20, 0.05) 1px, transparent 1px),
        rgba(0, 8, 0, 0.72);
}

button.projection-frame {
    appearance: none;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

button.projection-frame:hover,
button.projection-frame:focus-visible {
    outline: none;
    border-color: var(--line-strong);
    background-color: rgba(57, 255, 20, 0.08);
    box-shadow:
        inset 0 0 20px rgba(57, 255, 20, 0.1),
        0 0 16px rgba(57, 255, 20, 0.12);
}

button.projection-frame:active {
    transform: translateY(1px);
}

.projection-frame #hologramCanvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0.92;
    pointer-events: none;
}

.site-floorplan-preview {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
    opacity: 0;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.2));
    pointer-events: none;
    transition: opacity 180ms ease;
}

.site-floorplan-preview[hidden] {
    display: none;
}

.projection-frame.site-floorplan-active #hologramCanvas {
    opacity: 0.18;
}

.projection-frame.site-floorplan-active .site-floorplan-preview {
    opacity: 0.96;
}

.signal-row {
    display: grid;
    grid-template-columns: minmax(86px, 1fr) auto;
    align-items: center;
    gap: 10px;
    color: var(--phosphor);
    font-size: clamp(10px, 0.72vw, 12px);
    line-height: 1.3;
    min-width: 0;
    min-height: 28px;
    max-height: 34px;
}

.signal-spectrum-card {
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.signal-spectrum-widget {
    height: 100%;
    min-height: 0;
    padding: 0;
}

.signal-spectrum-widget .telemetry-svg {
    height: 100%;
    min-height: 0;
}

.right-actions-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(5px, 0.8vh, 8px);
    min-height: 0;
    overflow: hidden;
}

.side-action-module {
    width: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(3px, 0.55vh, 6px);
    align-items: stretch;
    overflow: hidden;
}

/* Plain headline above each panel — the animated graph below is the button. */
.side-action-title {
    margin: 0;
    color: var(--phosphor);
    font-size: clamp(10px, 0.72vw, 12px);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.08;
}

.side-glyph-button {
    appearance: none;
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
}

.side-glyph-button .side-ascii {
    display: block;
    height: 100%;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.side-glyph-button:hover .side-ascii,
.side-glyph-button:focus-visible .side-ascii {
    border-color: var(--line-strong);
    background-color: rgba(57, 255, 20, 0.08);
    box-shadow:
        inset 0 0 18px rgba(57, 255, 20, 0.1),
        0 0 14px rgba(57, 255, 20, 0.12);
}

.side-glyph-button:focus-visible {
    outline: none;
}

.side-glyph-button:active .side-ascii {
    transform: translateY(1px);
}

.side-ascii {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    min-height: 58px;
    margin: 0;
    padding: 7px 8px;
    overflow: hidden;
    border: 1px solid rgba(57, 255, 20, 0.2);
    background:
        linear-gradient(90deg, rgba(57, 255, 20, 0.05), transparent),
        rgba(0, 8, 0, 0.56);
    color: rgba(57, 255, 20, 0.82);
    font-family: var(--terminal-font);
    font-size: clamp(8px, 0.58vw, 10px);
    line-height: 1.08;
    text-shadow: 0 0 2px rgba(57, 255, 20, 0.32);
}

.signal-spectrum-widget {
    min-height: 0;
    padding: 0;
}

.signal-spectrum-widget .telemetry-svg,
.side-glyph-widget .telemetry-svg {
    height: 100%;
    min-height: 0;
}

.side-ascii pre {
    margin: 0;
    white-space: pre;
    font: inherit;
    letter-spacing: 0.02em;
}

.side-glyph-widget {
    height: 100%;
    min-height: 0;
    padding: 0;
}

.side-glyph-widget .telemetry-svg {
    height: 100%;
    min-height: 0;
}

.diag-ascii {
    display: block;
}

.facility-ascii {
    display: block;
    color: rgba(255, 173, 0, 0.88);
    text-shadow: 0 0 2px rgba(255, 173, 0, 0.28);
}

.ascii-line {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    white-space: nowrap;
}

.ascii-loader {
    display: inline-flex;
    gap: 2px;
    color: var(--phosphor);
}

.ascii-loader span {
    width: 1ch;
}

.ascii-loader span::before {
    content: ".";
    animation: asciiDot 1.1s steps(2, end) infinite;
}

.ascii-loader span:nth-child(2)::before { animation-delay: 0.16s; }
.ascii-loader span:nth-child(3)::before { animation-delay: 0.32s; }
.ascii-loader span:nth-child(4)::before { animation-delay: 0.48s; }

.ascii-graph {
    display: flex;
    justify-content: space-between;
    align-items: end;
    min-height: 28px;
    color: var(--phosphor);
    overflow: hidden;
}

.ascii-graph span {
    display: inline-block;
    animation: asciiGraph 1.35s steps(4, end) infinite;
}

.ascii-graph span:nth-child(2) { animation-delay: 0.12s; }
.ascii-graph span:nth-child(3) { animation-delay: 0.24s; }
.ascii-graph span:nth-child(4) { animation-delay: 0.36s; }
.ascii-graph span:nth-child(5) { animation-delay: 0.48s; }
.ascii-graph span:nth-child(6) { animation-delay: 0.60s; }
.ascii-graph span:nth-child(7) { animation-delay: 0.72s; }

.ascii-status {
    animation: asciiStatus 1.4s steps(3, end) infinite;
}

.facility-grid-mini {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px 4px;
    color: var(--amber);
}

.facility-grid-mini span {
    display: block;
    text-align: center;
}

.warn-cell {
    color: var(--phosphor);
    animation: cellPulse 1.2s steps(2, end) infinite;
}

.red-cell {
    color: var(--red);
    animation: cellPulse 0.9s steps(2, end) infinite reverse;
}

.signal-bars {
    display: flex;
    align-items: end;
    gap: 2px;
    height: 22px;
    max-height: 22px;
    min-width: 0;
    overflow: hidden;
}

.signal-bars span {
    flex: 1 1 4px;
    min-width: 2px;
    max-width: 5px;
    height: 45%;
    border: 1px solid var(--phosphor);
    background: rgba(57, 255, 20, 0.18);
    transform-origin: bottom;
    animation: signalPulse 1.35s ease-in-out infinite;
}

.signal-bars span:nth-child(n+4) { height: 65%; }
.signal-bars span:nth-child(n+7) { height: 88%; }
.signal-bars span.warn { border-color: var(--red); background: rgba(255, 48, 48, 0.18); }
.signal-bars span:nth-child(2) { animation-delay: 0.08s; }
.signal-bars span:nth-child(3) { animation-delay: 0.16s; }
.signal-bars span:nth-child(4) { animation-delay: 0.24s; }
.signal-bars span:nth-child(5) { animation-delay: 0.32s; }
.signal-bars span:nth-child(6) { animation-delay: 0.4s; }
.signal-bars span:nth-child(7) { animation-delay: 0.48s; }
.signal-bars span:nth-child(8) { animation-delay: 0.56s; }
.signal-bars span:nth-child(9) { animation-delay: 0.64s; }

@keyframes signalPulse {
    0%, 100% { transform: scaleY(0.72); opacity: 0.62; }
    45% { transform: scaleY(1); opacity: 1; }
}

@keyframes asciiDot {
    0%, 24% { content: "."; opacity: 0.35; }
    25%, 100% { content: "#"; opacity: 1; }
}

@keyframes asciiGraph {
    0%, 100% { transform: translateY(4px); opacity: 0.6; }
    50% { transform: translateY(-3px); opacity: 1; }
}

@keyframes asciiStatus {
    0%, 100% { color: var(--phosphor); }
    50% { color: var(--amber); }
}

@keyframes cellPulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

body.effects-low .signal-bars span,
body.effects-low .ascii-loader span::before,
body.effects-low .ascii-graph span,
body.effects-low .ascii-status,
body.effects-low .warn-cell,
body.effects-low .red-cell {
    animation-play-state: paused;
}

body.effects-low .header-panel,
body.effects-low .ares-wordmark,
body.effects-low .menu-panel,
body.effects-low .content-panel,
body.effects-low .system-sidebar,
body.effects-low .command-bar,
body.effects-low .side-card {
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.08);
}

body.effects-low .system-title,
body.effects-low .ares-mark pre,
body.effects-low .ares-wordmark .logo-amber,
body.effects-low .terminal-typewriter-line,
body.effects-low .side-ascii,
body.effects-low .facility-ascii,
body.effects-low .t-amber,
body.effects-low .t-red,
body.effects-low .t-cyan,
body.effects-low .t-magenta,
body.effects-low .t-bright {
    text-shadow: 0 0 1px currentColor;
}

body.effects-low .status-dot,
body.effects-low .cursor-block,
body.effects-low .terminal-typewriter-active::after {
    box-shadow: none;
}

body.effects-low .status-dot {
    animation: none;
}

body.network-offline .signal-bars span,
body.network-offline .ascii-loader span::before,
body.network-offline .ascii-graph span,
body.network-offline .ascii-status,
body.network-offline .warn-cell,
body.network-offline .red-cell {
    animation-play-state: paused;
}

body.network-offline .projection-frame #hologramCanvas {
    opacity: 0.26;
}

button.projection-frame.network-locked {
    border-color: rgba(255, 48, 48, 0.42);
    background-color: rgba(255, 48, 48, 0.05);
}

button.projection-frame.site-locked {
    border-color: rgba(255, 173, 0, 0.48);
    background-color: rgba(255, 173, 0, 0.055);
    cursor: not-allowed;
}

body.network-offline .side-ascii {
    border-color: rgba(255, 48, 48, 0.32);
    color: rgba(255, 48, 48, 0.72);
    text-shadow: 0 0 2px rgba(255, 48, 48, 0.24);
}

.status-toggle.network-transitioning {
    color: var(--amber);
    border-color: rgba(255, 173, 0, 0.48);
    cursor: wait;
}

/* Locked states tint the clickable graph panel (the widgets themselves
   render their NET OFFLINE / sensor-paused text inside the SVG). */
.side-glyph-button.network-locked .side-ascii {
    border-color: rgba(255, 48, 48, 0.42);
    background-color: rgba(255, 48, 48, 0.05);
}

.side-glyph-button.site-locked .side-ascii {
    border-color: rgba(255, 173, 0, 0.48);
    background-color: rgba(255, 173, 0, 0.055);
}

.side-glyph-button.site-locked {
    cursor: not-allowed;
}

.cli-divider,
.entry-divider {
    letter-spacing: 0.02em;
    text-shadow: none;
}

.diagnostic-readout,
.facility-readout {
    font-size: clamp(9px, 0.66vw, 11px);
    line-height: 1.12;
    letter-spacing: -0.01em;
}

.side-value {
    color: var(--phosphor);
    font-size: clamp(10px, 0.75vw, 13px);
    letter-spacing: 0.03em;
    overflow-wrap: anywhere;
}

.command-bar {
    min-height: 68px;
    padding: 12px 0;
    display: grid;
    grid-template-columns: var(--shell-left-col) var(--shell-main-col) var(--shell-right-col);
    align-items: center;
    gap: var(--shell-gap);
}

.command-version {
    grid-column: 1;
    padding-left: 12px;
    color: var(--phosphor);
    letter-spacing: 0.08em;
}

.command-entry {
    grid-column: 2;
    min-width: 0;
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 1px solid rgba(57, 255, 20, 0.25);
    background: rgba(57, 255, 20, 0.055);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.prompt {
    margin: 0;
    color: var(--phosphor-glow);
    font-size: 32px;
}

#commandInput {
    width: 100%;
    min-height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--phosphor);
    font-family: var(--terminal-font);
    font-size: var(--font-size-base);
    outline: none;
}

#commandInput::placeholder {
    color: rgba(57, 255, 20, 0.34);
}

.execute-button {
    grid-column: 3;
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    background: rgba(0, 18, 0, 0.72);
    color: var(--phosphor);
    font-family: var(--terminal-font);
    font-size: var(--font-size-small);
    letter-spacing: 0.08em;
    cursor: pointer;
}

.execute-button:hover,
.execute-button:focus-visible {
    outline: none;
    border-color: var(--line-strong);
    background: rgba(57, 255, 20, 0.12);
}

@media (max-width: 1260px) {
    .screen-content {
        --shell-left-col: 147px;
        --shell-right-col: 154px;
        --shell-main-col: minmax(360px, 1fr);
    }

    .system-title {
        font-size: clamp(20px, 2.6vw, 30px);
    }

    .content-brand {
        min-height: 92px;
    }

    .brand-sigil {
        width: 68px;
        height: 68px;
        font-size: 46px;
    }

    .menu-item {
        grid-template-columns: 24px minmax(0, 1fr);
        gap: 6px;
        padding-inline: 8px 24px;
    }

    .menu-item .icon {
        width: 22px;
        font-size: 17px;
    }

    .side-card {
        padding-inline: 10px;
    }
}

@media (max-width: 980px) {
    .terminal-shell {
        padding: 10px;
        overflow: auto;
    }

    .screen-content {
        --shell-left-col: 1fr;
        --shell-right-col: 1fr;
        --shell-main-col: 1fr;
        --side-overview-row: auto;
        --side-signal-row: auto;
        --side-actions-row: auto;
        min-height: var(--viewport-height);
        height: auto;
        grid-template-rows: auto auto auto;
    }

    .terminal-header {
        grid-template-columns: 1fr;
    }

    .header-panel,
    .ares-wordmark {
        grid-column: 1;
    }

    .ares-wordmark {
        display: none;
    }

    .header-panel {
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .header-info {
        grid-column: 1 / -1;
        justify-self: stretch;
        border-left: 0;
        border-top: 1px solid rgba(57, 255, 20, 0.2);
        padding: 8px 0 0;
    }

    .ares-mark {
        width: 54px;
        height: 54px;
    }

    .terminal-body {
        grid-template-columns: 1fr;
    }

    .menu-panel {
        max-height: none;
    }

    .menu-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: none;
    }

    .menu-title,
    .menu-section-title {
        grid-column: 1 / -1;
    }

    .system-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto auto;
        overflow: visible;
    }

    .facility-overview-card {
        grid-column: 1 / -1;
    }

    .right-actions-card {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto minmax(0, auto);
    }

    .right-actions-card h2 {
        grid-column: 1 / -1;
    }

    .content-panel {
        min-height: 58vh;
    }

    .command-bar {
        position: sticky;
        bottom: 0;
        z-index: 50;
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .command-version {
        display: none;
    }

    .command-entry {
        grid-column: 1 / 3;
    }

    .execute-button {
        grid-column: 3;
    }
}

@media (max-width: 620px) {
    .terminal-shell {
        padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    }

    .screen-content {
        gap: 8px;
    }

    .header-panel {
        padding: 10px;
        gap: 10px;
    }

    .system-title {
        white-space: normal;
        font-size: 20px;
        line-height: 1.08;
    }

    .status-bar {
        gap: 5px;
    }

    .status-item {
        min-height: 28px;
        padding-inline: 8px;
    }

    .menu-panel {
        padding: 10px;
    }

    .menu-list {
        grid-template-columns: 1fr;
    }

    .menu-item {
        min-height: 46px;
    }

    .content-toolbar {
        flex-wrap: wrap;
        gap: 8px 14px;
    }

    .toolbar-right {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .content-brand {
        margin: 10px 10px 0;
        min-height: 76px;
        gap: 12px;
    }

    .brand-sigil {
        width: 50px;
        height: 50px;
        font-size: 34px;
    }

    .brand-name {
        font-size: 18px;
        letter-spacing: 0.1em;
    }

    .brand-motto {
        font-size: 10px;
        letter-spacing: 0.12em;
    }

    .content-viewport {
        margin: 0 10px 10px;
        min-height: 46vh;
    }

    .content-area {
        padding: 12px;
    }

    .system-sidebar {
        grid-template-columns: 1fr;
    }

    .right-actions-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .command-bar {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px;
        padding: 10px;
    }

    .command-entry {
        grid-column: 1 / -1;
    }

    .execute-button {
        grid-column: 1 / -1;
        min-height: 44px;
    }

    .prompt {
        font-size: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .terminal-shell {
        background-size: 100% 100%;
    }

    .menu-item,
    .execute-button {
        transition-duration: 0.01ms !important;
    }

    .status-dot,
    .signal-bars span,
    .ascii-loader span::before,
    .ascii-graph span,
    .ascii-status,
    .warn-cell,
    .red-cell {
        animation: none !important;
    }
}

/* Stabilization overrides: keep the terminal style, but make expensive glow
   and SVG filter effects cheaper in Firefox, low effects, reduced motion, and safe mode. */
.browser-firefox .telemetry-trace,
.browser-firefox .ares-wordmark-svg,
.render-low .telemetry-trace,
.render-low .ares-wordmark-svg,
.render-reduced .telemetry-trace,
.render-reduced .ares-wordmark-svg,
.safe-mode .telemetry-trace,
.safe-mode .ares-wordmark-svg {
    filter: none;
}

.browser-firefox .ares-wordmark-scan,
.render-low .ares-wordmark-scan,
.render-reduced .ares-wordmark-scan,
.safe-mode .ares-wordmark-scan,
.render-low .ares-wordmark-svg .ares-emblem-core,
.render-low .ares-wordmark-svg