/* ===== Terminal Window ===== */
.terminal-window {
    position: absolute;
    width: 800px;
    min-height: 360px;
    max-height: 85vh;
    background: var(--hx-terminal-bg);
    border: 1px solid var(--hx-terminal-border);
    border-radius: 8px;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(151, 240, 29, 0.08);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    font-family: var(--hx-font);
    overflow: hidden;
    transition: opacity 0.15s, transform 0.15s;
}

.terminal-window.opening {
    opacity: 0;
    transform: scale(0.95);
}

.terminal-window.minimized {
    display: none;
}

.terminal-window.maximized {
    width: 100% !important;
    height: calc(100vh - 40px) !important;
    max-height: calc(100vh - 40px) !important;
    top: 0 !important;
    left: 0 !important;
    border-radius: 0;
}

/* ===== Titlebar ===== */
.terminal-titlebar {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 10px;
    background: rgba(30, 35, 40, 0.95);
    border-bottom: 1px solid rgba(151, 240, 29, 0.1);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.terminal-titlebar:active {
    cursor: grabbing;
}

.terminal-winbtns {
    display: flex;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.terminal-winbtn {
    width: 26px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(151, 240, 29, 0.25);
    background: rgba(151, 240, 29, 0.06);
    color: var(--hx-green);
    font-size: 14px;
    font-family: var(--hx-font);
    line-height: 1;
    padding: 0;
    transition: background 0.1s;
}

.terminal-winbtn:hover {
    background: rgba(151, 240, 29, 0.15);
}

.terminal-winbtn-close:hover {
    background: rgba(255, 95, 87, 0.3);
    border-color: rgba(255, 95, 87, 0.5);
    color: #ff5f57;
}

.terminal-title {
    flex: 1;
    font-size: 13px;
    color: rgba(151, 240, 29, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Terminal Body ===== */
.terminal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 20px;
    line-height: 1.6;
    color: var(--hx-green);
    min-height: 240px;
}

/* Scrollbar */
.terminal-body::-webkit-scrollbar {
    width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
    background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(151, 240, 29, 0.2);
    border-radius: 3px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(151, 240, 29, 0.35);
}

/* ===== Terminal Lines ===== */
.term-line {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.term-line.command {
    color: var(--hx-green);
    text-shadow: var(--hx-glow);
}

.term-line.dim {
    color: #4a6a2a;
}

.term-line.highlight {
    color: #b4ff40;
    font-weight: 700;
}

.term-line.status-live {
    color: #28c840;
    font-weight: 700;
}

.term-line.status-demo {
    color: var(--hx-blue);
    font-weight: 700;
}

.term-line.status-dev {
    color: #ffbd2e;
    font-weight: 700;
}

.term-line.status-denied {
    color: #ff5f57;
    font-weight: 700;
}

.term-line.launch {
    color: var(--hx-green);
    text-shadow: var(--hx-glow);
    cursor: pointer;
    margin-top: 8px;
}

.term-line.launch:hover {
    text-decoration: underline;
}

/* ===== More Info Prompt ===== */
.term-line.more-info-prompt {
    color: var(--hx-blue);
    cursor: pointer;
    margin-top: 4px;
}

.term-line.more-info-prompt:hover {
    text-decoration: underline;
}

/* ===== Pixel Art Canvas ===== */
.pixel-art-canvas {
    display: block;
    width: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    margin: 8px 0;
    border-radius: 2px;
}

.term-line.empty {
    height: 1.6em;
}

/* ===== Blinking Cursor ===== */
.term-cursor {
    display: inline-block;
    width: 12px;
    height: 22px;
    background: var(--hx-green);
    animation: cursorBlink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ===== Password Input ===== */
.term-password-line {
    display: flex;
    align-items: center;
}

.term-password-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--hx-green);
    font-family: var(--hx-font);
    font-size: 20px;
    caret-color: var(--hx-green);
    width: 240px;
    padding: 0;
    margin: 0;
}

.term-password-input:disabled {
    opacity: 0.5;
}

/* ===== No URL Message ===== */
.term-no-url {
    color: #ff5f57;
    font-size: 12px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.term-no-url.visible {
    opacity: 1;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .terminal-window {
        position: fixed !important;
        width: 100% !important;
        height: calc(100dvh - 36px) !important;
        max-height: calc(100dvh - 36px) !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0;
        border: none;
        z-index: 10500 !important;
    }

    .terminal-titlebar {
        height: 44px;
        padding: 0 10px;
        flex-shrink: 0;
    }

    .terminal-winbtn:not(.terminal-winbtn-close) {
        display: none;
    }

    .terminal-winbtn-close {
        width: 40px;
        height: 34px;
        font-size: 20px;
    }

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

    .terminal-body {
        font-size: 13px;
        padding: 10px;
        overflow-x: auto;
        min-height: 0;
    }

    .term-line {
        white-space: pre;
        word-break: normal;
    }

    .term-password-input {
        font-size: 13px;
    }

    .term-line.more-info-prompt {
        display: inline-block;
        padding: 8px 16px;
        margin-top: 8px;
        border: 1px solid var(--hx-blue);
        border-radius: 4px;
        background: rgba(0, 168, 255, 0.08);
        font-size: 13px;
    }
}
