:root {
    --bg-color: #0d0d0d;
    --grid-color: #1a1c22;
    --accent-color: #ff5e00;
    --text-color: #e0e0e0;
    --font-mono: 'JetBrains Mono', monospace;
}

body {
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    color: var(--text-color);
    font-family: var(--font-mono);
    margin: 0;
    overflow-x: hidden;
}

#pipe-system {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

.blueprint-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 20px;
}

.core {
    width: 160px;
    height: 80px;
    border: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 120px;
    background: var(--bg-color);
    font-weight: bold;
    letter-spacing: 2px;
    transition: opacity 0.3s;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 300px);
    gap: 80px 60px;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    transition: all 0.3s ease;
}

/* Эффект затухания остальных карточек */
.modules-grid.focus-mode .module-card:not(:hover) {
    opacity: 0.15;
    filter: grayscale(1);
}

.module-card {
    position: relative;
    background: rgba(13, 13, 13, 0.95);
    padding: 20px;
    border: 1px solid #222;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.module-card::before, .module-card::after {
    content: "";
    position: absolute;
    width: 15px; height: 15px;
    border-color: var(--accent-color);
    border-style: solid;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.module-card::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.module-card::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.module-card:hover {
    border-color: transparent;
    background: rgba(255, 94, 0, 0.05);
    transform: scale(1.02);
}

.module-card:hover::before, .module-card:hover::after {
    width: calc(100% + 2px);
    height: calc(100% + 2px);
}

.unit-id { font-size: 9px; color: var(--accent-color); display: block; margin-bottom: 5px; }
.unit-name { font-size: 16px; text-transform: uppercase; margin-bottom: 10px; display: block; }
.unit-data { font-size: 12px; color: #666; border-top: 1px solid #222; padding-top: 8px; }

/* Линии связи */
.pipe-line {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 1;
    stroke-dasharray: 8;
    animation: flow 10s linear infinite;
    opacity: 0.1;
    transition: all 0.3s ease;
}

.pipe-line.active {
    opacity: 0.8;
    stroke-width: 2;
    filter: drop-shadow(0 0 8px var(--accent-color));
}

@keyframes flow {
    from { stroke-dashoffset: 200; }
    to { stroke-dashoffset: 0; }
}

@media (max-width: 800px) {
    #pipe-system { display: none; }
    .modules-grid { grid-template-columns: 1fr; }
}

/* Состояние заблокированного модуля */
.module-card.locked {
    filter: blur(8px) grayscale(1); /* Сильное размытие */
    pointer-events: none;          /* Нельзя кликнуть */
    opacity: 0.4;
    cursor: not-allowed;
}

/* Терминал внизу */
.terminal-bar {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    background: #000;
    border-top: 2px solid var(--accent-color);
    padding: 10px 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 20px rgba(255, 94, 0, 0.3);
}

.terminal-header {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    font-size: 11px;
    margin-bottom: 5px;
    font-weight: bold;
}

#terminal-input {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-family: var(--font-mono);
    font-size: 18px;
    outline: none;
    width: 100%;
    caret-color: var(--accent-color); /* Мигающий курсор */
}

/* Скрываем терминал, если он мешает (опционально) */
.terminal-bar.minimized {
    height: 40px;
}


#sys-status { color: #ff0000; font-weight: bold; }
#sys-status.online { color: #00ff00; }

.terminal-path { color: #555; }


/* Подсветка при фокусе на вводе */
.terminal-bar:focus-within {
    box-shadow: 0 0 20px rgba(255, 94, 0, 0.2);
}