/* --- 1. ПЕРЕМЕННЫЕ И БАЗОВЫЕ СТИЛИ --- */
:root {
    --accent: #00ff41;
    --bg: #0a0a0a;
    --card: rgba(20, 20, 20, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --text-main: #e0e0e0;
    --text-muted: #8b949e;
    --font-mono: 'Fira Code', monospace;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    padding: 50px 20px;
    min-height: 100vh;
}

.container { 
    width: 100%; 
    max-width: 800px; 
    display: flex;
    flex-direction: column;
}

/* --- 2. БРЕНД СЕКЦИЯ --- */
.brand-section { text-align: center; margin-bottom: 40px; flex-shrink: 0; }

.photo-wrap {
    width: 140px; height: 140px;
    margin: 0 auto 20px;
    border: 2px solid var(--accent);
    padding: 5px; border-radius: 50%;
}

.main-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.glitch { font-size: 2.5rem; margin: 10px 0; }
.role { color: var(--accent); opacity: 0.8; }

/* --- 3. ТЕРМИНАЛ (ОБОЛОЧКА) --- */
.terminal {
    background: var(--card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-width: 100%;
    word-wrap: break-word;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    cursor: text;
}

.term-bar {
    background: rgba(255, 255, 255, 0.07);
    padding: 10px 15px;
    display: flex; 
    align-items: center;
    position: relative;
    user-select: none;
    flex-shrink: 0;
}

.dots { display: flex; gap: 8px; z-index: 2; }
.dots span { width: 12px; height: 12px; border-radius: 50%; }
.r { background: #ff5f56; } .y { background: #ffbd2e; } .g { background: #27c93f; }

.term-title {
    position: absolute; width: 100%; text-align: center;
    font-size: 12px; color: var(--text-muted); font-family: monospace;
}

.term-body { 
    padding: 25px; 
    font-family: var(--font-mono); 
    font-size: 14px; 
    line-height: 1.6;
    flex-grow: 1;
    overflow-y: auto;
}

/* --- 4. ЗАГРУЗКА И СИСТЕМНАЯ ИНФО --- */
.boot-line {
    opacity: 0;
    font-size: 12px;
    color: #58a6ff;
    animation: fadeIn 0.1s forwards;
}

#loading-zone { opacity: 0; transition: opacity 0.3s; }
#loading-zone.active { opacity: 1; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 5px 20px;
    margin: 15px 0;
    color: var(--text-muted);
}
.stats-grid .val { color: #fff; }

#system-info { display: none; color: #d1d5da; font-size: 13px; margin-bottom: 20px; }

/* --- 5. КОМАНДЫ И ВВОД --- */
.line-group, .final-line {
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.visible { opacity: 1 !important; transform: translateY(0) !important; }

.line { display: flex; align-items: center; flex-wrap: wrap; }
.line .user { color: var(--accent); font-weight: bold; }
.line .path { color: #79c0ff; font-weight: bold; }
.line .char { color: #fff; margin: 0 10px 0 2px; }
.line-cmd { color: #fff; text-shadow: 0 0 5px rgba(255, 255, 255, 0.2); }

#terminal-input {
    position: absolute;
    left: -9999px;
}

.cursor {
    display: inline-block;
    width: 8px; height: 16px;
    background-color: var(--accent);
    margin-left: 4px;
    animation: blink 1s steps(2, start) infinite;
}

/* --- 6. РЕЗУЛЬТАТЫ ВЫВОДА --- */
.output, .stack-box {
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    pointer-events: none;
}

.show-res .output, .show-res .stack-box {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.output { 
    color: #aaa; 
    margin: 8px 0 20px 25px; 
    font-size: 13px;
    border-left: 1px solid var(--border);
    padding-left: 15px;
}

.output a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: 0.3s;
}
.output a:hover { border-color: var(--accent); background: rgba(0, 255, 65, 0.1); }

.stack-box {
    color: #d1d5da;
    margin: 15px 0 30px 35px;
    background: rgba(255, 255, 255, 0.02);
    padding: 15px;
    border-radius: 6px;
    border-left: 2px solid var(--accent);
    font-size: 13px;
}
.stack-box .key { color: #79c0ff; }
.stack-box .val { color: #ffa657; }

/* --- 8. АНИМАЦИИ --- */
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }
@keyframes blink { to { visibility: hidden; } }

#progress-bar { color: var(--accent); letter-spacing: 2px; }


/* --- АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ --- */
@media (max-width: 600px) {
    html, body {
        height: 100dvh; 
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        background-color: var(--bg);
    }

    body {
        display: flex;
        flex-direction: column;
    }

    .container {
        height: 100dvh;
        max-height: 100dvh;
        display: flex;
        flex-direction: column;
        padding: 15px;
        box-sizing: border-box;
        justify-content: space-between;
    }

    /* --- ВЕРХ (Компактный) --- */
    .brand-section {
        flex: 0 0 auto;
        margin-bottom: 15px;
    }

    .photo-wrap { 
        width: 80px; 
        height: 80px; 
        margin-bottom: 10px; 
    }
    
    .glitch { font-size: 1.4rem; margin: 5px 0; }
    .role { font-size: 0.85rem; }

    /* --- СЕРЕДИНА (Терминал) --- */
    .terminal {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        height: 0;
        flex-direction: column;
        margin-bottom: 15px;
    }

    .term-body {
        flex: 1; 
        overflow-y: auto !important;
        padding: 15px;
        font-size: 12px;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
}