:root {
    --font: "JetBrains Mono";
}

.preloader {
    font-family: "JetBrains Mono";
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: var(--base);
}

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

.statusbar {
    flex: 0 0 auto;
}

#terminal {
    flex: 1 1 auto;
    min-height: 0;
}

.terminal {
    --size: 1.6;
    --color: var(--text);
    --background: var(--base);
    --link-color: var(--blue);
    padding: 16px 24px;
}

.cmd-link {
    cursor: pointer;
    border-bottom: 1px dotted transparent;
    transition: border-color 0.15s;
}

.cmd-link:hover {
    border-bottom-color: currentColor;
}

/* ---------- boas-vindas (neofetch) ---------- */
.fetch,
.fetch-info div {
    white-space: normal;
}

.fetch {
    margin: 4px 0 8px;
}

.fetch-user { color: var(--green); }
.fetch-path { color: var(--blue); }

.fetch-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 40px;
    margin: 14px 0 18px;
}

.fetch-logo {
    margin: 4px 0 0;
    color: var(--mauve);
    font-family: inherit;
    font-size: min(0.62em, calc((100vw - 48px) / 44));
    line-height: 1;
}

.fetch-info {
    flex: 0 1 46ch;
    min-width: 0;
}

.fetch-row {
    display: grid;
    grid-template-columns: 10ch 1fr;
}

/* jQuery Terminal adiciona um ::before em divs da saída, o que quebra grid e flex */
.terminal-output div:has(> .fetch)::before,
.terminal-output .fetch::before,
.terminal-output .fetch div::before {
    content: none;
    display: none;
}

.fetch-key {
    color: var(--blue);
}

.fetch-sep { color: var(--overlay0); }

.fetch-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--green);
}

.fetch-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); }
    50% { box-shadow: 0 0 0 6px transparent; }
}

.fetch-hints { color: var(--subtext); }
.fetch-link { color: var(--green); }

@media (prefers-reduced-motion: reduce) {
    .fetch-dot { animation: none; }
}

.terminal-spinner::after {
    content: "⠋";
    display: inline-block;
    color: var(--green);
    animation: spinner 0.8s steps(1) infinite;
}

@keyframes spinner {
    0%      { content: "⠋"; }
    10%     { content: "⠙"; }
    20%     { content: "⠹"; }
    30%     { content: "⠸"; }
    40%     { content: "⠼"; }
    50%     { content: "⠴"; }
    60%     { content: "⠦"; }
    70%     { content: "⠧"; }
    80%     { content: "⠇"; }
    90%     { content: "⠏"; }
}

#mobile-toolbar {
    display: none;
}

@media screen and (max-width: 768px) {
    html, body {
        height: 100dvh;
    }

    .terminal {
        --size: 1.35;
        padding: 12px 10px;
    }

    .statusbar .window {
        display: none;
    }

    #terminal {
        overflow-x: hidden;
    }

    #terminal,
    .terminal,
    .terminal-scroller {
        scrollbar-width: thin;
        scrollbar-color: var(--surface1) transparent;
    }

    #terminal::-webkit-scrollbar,
    .terminal::-webkit-scrollbar,
    .terminal-scroller::-webkit-scrollbar {
        width: 6px;
        height: 0;
        background: transparent;
    }

    #terminal::-webkit-scrollbar-track,
    .terminal::-webkit-scrollbar-track,
    .terminal-scroller::-webkit-scrollbar-track {
        background: transparent;
    }

    #terminal::-webkit-scrollbar-thumb,
    .terminal::-webkit-scrollbar-thumb,
    .terminal-scroller::-webkit-scrollbar-thumb {
        background: var(--surface1);
        border-radius: 3px;
    }

    #terminal::-webkit-scrollbar-corner,
    .terminal::-webkit-scrollbar-corner,
    .terminal-scroller::-webkit-scrollbar-corner {
        background: transparent;
    }

    #mobile-toolbar {
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
        background: var(--mantle);
        border-top: 1px solid var(--surface0);
        padding: 8px 10px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
        gap: 8px;
    }

    .toolbar-chips {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .toolbar-chips .chip {
        background: var(--surface0);
        color: var(--text);
        border: 1px solid var(--surface1);
        border-radius: 14px;
        padding: 5px 14px;
        font-family: var(--mono);
        font-size: 13px;
        white-space: nowrap;
        cursor: pointer;
        flex-shrink: 0;
        transition: background 0.15s;
    }

    .toolbar-chips .chip:active {
        background: var(--surface1);
    }

    .toolbar-input {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--base);
        border: 1px solid var(--surface1);
        border-radius: 8px;
        padding: 6px 10px;
    }

    .toolbar-prompt {
        color: var(--green);
        font-family: var(--mono);
        font-size: 14px;
        font-weight: bold;
    }

    .toolbar-input input {
        flex: 1;
        background: transparent;
        border: none;
        outline: none;
        color: var(--text);
        font-family: var(--mono);
        font-size: 14px;
    }

    .toolbar-input input::placeholder {
        color: var(--overlay0);
    }

    #mobile-send {
        background: transparent;
        border: none;
        color: var(--blue);
        font-size: 18px;
        cursor: pointer;
        padding: 2px 6px;
    }

    #mobile-send:active {
        color: var(--green);
    }
}
