:root {
    --page-bg: #030405;
    --panel-bg: rgba(5, 7, 8, 0.82);
    --panel-bg-strong: rgba(10, 13, 14, 0.92);
    --panel-border: rgba(226, 224, 218, 0.18);
    --panel-border-soft: rgba(226, 224, 218, 0.08);
    --text: rgba(242, 244, 247, 0.94);
    --text-soft: rgba(214, 219, 224, 0.78);
    --text-muted: rgba(164, 171, 178, 0.68);
    --accent: #f56b36;
    --accent-soft: rgba(245, 107, 54, 0.16);
    --terminal-green: #8fd8a0;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Source Code Pro", "DejaVu Sans Mono", "Liberation Mono", "Ubuntu Mono", Consolas, monospace;
    letter-spacing: 0;
}

body {
    min-height: 100svh;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(3, 4, 5, 0.36), rgba(3, 4, 5, 0.04) 44%, rgba(3, 4, 5, 0.42)),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 5px);
    z-index: 1;
}

#bgScene {
    position: fixed;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

#terminalProfile {
    position: relative;
    z-index: 2;
    min-height: 100svh;
    display: grid;
    align-items: center;
    justify-items: start;
    padding: 56px 64px;
    box-sizing: border-box;
}

.terminal-window {
    position: fixed;
    top: 56px;
    left: 64px;
    display: flex;
    flex-direction: column;
    width: min(720px, calc(100vw - 96px));
    min-width: min(320px, calc(100vw - 28px));
    min-height: 280px;
    max-width: calc(100vw - 28px);
    max-height: calc(100svh - 28px);
    overflow: hidden;
    background: linear-gradient(180deg, var(--panel-bg-strong), var(--panel-bg));
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    box-shadow:
        0 0 0 1px rgba(245, 107, 54, 0.04),
        0 24px 80px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(10px);
    animation: bootIn 460ms ease-out both;
}

.terminal-window.is-dragging,
.terminal-window.is-resizing {
    transition: none;
    user-select: none;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    flex: 0 0 auto;
    padding: 0 14px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.035);
    border-bottom: 1px solid var(--panel-border-soft);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.terminal-window.is-dragging .terminal-bar {
    cursor: grabbing;
}

.terminal-bar span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(226, 224, 218, 0.32);
}

.terminal-bar span:first-child {
    background: rgba(245, 107, 54, 0.82);
}

.terminal-bar span:nth-child(2) {
    background: rgba(226, 224, 218, 0.48);
}

.terminal-bar span:nth-child(3) {
    background: rgba(143, 216, 160, 0.58);
}

.terminal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 24px 26px 26px;
}

.terminal-resize-grip {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 24px;
    height: 24px;
    cursor: nwse-resize;
    touch-action: none;
}

.terminal-resize-grip::before {
    content: "";
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    opacity: 0.78;
}

.terminal-kicker {
    margin: 0 0 10px;
    color: var(--terminal-green);
    font-size: 12px;
    line-height: 1.35;
}

[data-terminal-command] {
    white-space: pre;
}

.terminal-booting [data-terminal-command] {
    visibility: hidden;
}

.terminal-booting [data-terminal-line],
.terminal-window.is-animating [data-terminal-line] {
    visibility: hidden;
}

.terminal-window.is-animating [data-terminal-line].is-visible {
    visibility: visible;
}

.terminal-booting [data-terminal-output] {
    opacity: 0;
    transform: translateY(6px);
}

.terminal-window.is-animating [data-terminal-output] {
    opacity: 0;
    transform: translateY(6px);
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}

.terminal-window.is-animating [data-terminal-output].is-visible {
    opacity: 1;
    transform: translateY(0);
}

h1 {
    margin: 0 0 20px;
    color: var(--text);
    font-size: 34px;
    line-height: 1.06;
    font-weight: 700;
    letter-spacing: 0;
}

.terminal-line {
    display: flex;
    align-items: baseline;
    gap: 9px;
    margin: 18px 0 8px;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.35;
    font-weight: 600;
}

.terminal-prompt {
    color: var(--accent);
    flex: 0 0 auto;
}

.terminal-output,
.terminal-list {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.55;
}

.terminal-output {
    max-width: 66ch;
}

.terminal-list {
    display: grid;
    gap: 8px;
    padding: 0;
    list-style: none;
}

.terminal-list li {
    position: relative;
    padding-left: 18px;
}

.terminal-list li::before {
    content: "-";
    position: absolute;
    left: 0;
    color: var(--accent);
}

.terminal-list strong {
    color: var(--text);
    font-weight: 700;
}

.terminal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 4px;
}

.terminal-links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    color: var(--text);
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    transition:
        color 140ms ease,
        background-color 140ms ease;
}

.terminal-links a::before {
    content: "./";
    color: var(--text-muted);
}

.terminal-links a:hover,
.terminal-links a:focus-visible {
    color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

.terminal-links a:hover::before,
.terminal-links a:focus-visible::before {
    color: var(--accent);
}

.terminal-active {
    margin-bottom: 0;
    color: var(--terminal-green);
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    margin-left: 2px;
    background: var(--accent);
    transform: translateY(2px);
    animation: cursorBlink 1.6s steps(1, end) infinite;
}

@keyframes bootIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cursorBlink {
    0%,
    48% {
        opacity: 1;
    }

    49%,
    100% {
        opacity: 0;
    }
}

@media (max-width: 640px) {
    #terminalProfile {
        align-items: start;
        padding: 18px 14px;
    }

    .terminal-window {
        top: 18px;
        left: 14px;
        width: calc(100vw - 28px);
        min-height: min(420px, calc(100svh - 36px));
    }

    .terminal-body {
        padding: 18px 16px 20px;
    }

    .terminal-kicker {
        font-size: 12px;
    }

    h1 {
        margin-bottom: 18px;
        font-size: 24px;
        line-height: 1.12;
    }

    .terminal-line {
        margin-top: 16px;
        font-size: 12px;
    }

    .terminal-output,
    .terminal-list,
    .terminal-links a {
        font-size: 12px;
    }

    .terminal-output,
    .terminal-list {
        line-height: 1.48;
    }

    .terminal-links {
        gap: 6px 12px;
    }

}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        transition-duration: 1ms !important;
    }

    .terminal-cursor {
        animation-duration: 1.6s !important;
    }

}
