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

html, body {
    background-color: #16161d;
}

/* Typography optimization */
body, input {
    font-family: 'Ubuntu Mono', monospace;
}

/* Links styling combined */
a {
    color: #729fcf;
    transition: color 0.2s;
}
a:hover {
    color: #4e9a06 !important;
}
a:visited {
    color: #729fcf;
}
a:active {
    color: #cc0000;
}

pre.terminal-output {
    margin: 0;
    padding: 0;
    line-height: 1;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.terminal-window {
    background-color: #300a24;
    width: 900px;
    height: 600px;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: absolute;
    transform: translate3d(0, 0, 0); /* Hardware acceleration */
    will-change: transform, left, top; /* Performance optimization */
}

.terminal-header {
    background: linear-gradient(to bottom, #504b45 0%, #3c3b37 100%);
    height: 30px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    position: relative;
    user-select: none; /* Prevent text selection in header */
}

/* Button styling - grouped for better readability */
.terminal-buttons {
    display: flex;
    gap: 6px;
}

.terminal-button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.close { background-color: #ff5f56; }
.minimize { background-color: #ffbd2e; }
.maximize { background-color: #27c93f; }

.close:hover { background-color: #bb4640; }
.minimize:hover { background-color: rgb(156, 115, 0); }
.maximize:hover { background-color: #1e7e2b; }

.terminal-title {
    color: #d5d0ce;
    font-size: 18px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.terminal-container {
    flex: 1;
    background-color: rgba(48, 10, 36, 0.95);
    color: #fff;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    word-wrap: break-word;
    word-break: break-word;
    font-size: 22px;
    line-height: 1.5;
    padding: 10px;
}

.welcome-message {
    color: #ffffff;
    opacity: 0.9;
}

/* Input styling */
.terminal-input-line {
    padding: 10px;
    display: flex;
    font-size: 22px;
    line-height: 1.5;
}

.terminal-input-line-inline {
    padding: 0;
    display: inline;
    line-height: 1.5;
}

.prompt-user {
    color: #4e9a06;
}

.prompt-location {
    color: #3465a4;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    outline: none;
    font-size: 22px;
    caret-color: #fff;
    margin-left: 5px;
}

.command-output {
    margin: 5px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
}

/* Text styling - grouped by color */
.error-text { color: #cc0000; }
.success-text { color: #4e9a06; }
.notice-text { color: #c4a000; }
.file-text { color: #729fcf; }
.directory-text { color: #4e9a06; }

/* Animation for typing cursor - optimized */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#terminal-input::after {
    content: '|';
    animation: blink 1s infinite;
}

/* Scrollbar styling - simplified */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Drag functionality styles */
.dragging {
    opacity: 0.95;
    user-select: none !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.dragging .terminal-header {
    cursor: grabbing;
}

/* Mobile responsiveness - optimized with fewer repeated properties */
@media (max-width: 850px) {
    html, body {
        margin: 0;
        padding: 0;
        overflow: hidden;
        height: 100%;
        width: 100%;
        position: fixed;
    }

    .terminal-button {
        width: 14px;
        height: 14px;
    }

    .terminal-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        transform: none;
    }

    .terminal-header {
        height: 40px;
    }

    .terminal-title {
        font-size: 14px;
    }

    .terminal-container {
        position: relative;
        overflow: hidden;
        padding: 0;
    }

    .terminal-output {
        position: absolute;
        top: 0;
        bottom: 50px;
        left: 0;
        right: 0;
        padding: 5px 10px;
        font-size: 16px;
        line-height: 1.3;
        -webkit-overflow-scrolling: touch;
    }

    .terminal-input-line {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 8px 5px;
        width: 100%;
        z-index: 100;
        font-size: 16px;
        background-color: rgba(0, 0, 0, 0.25);
    }

    #terminal-input {
        font-size: 16px;
    }
}
