/* ===============================================================
   AndersHell 3000 Terminal - Base Styling
   =============================================================== */

.andershell-terminal {
    position: relative;
    background: radial-gradient(circle at 10% 20%, #0c0c0c 0%, #050505 70%);
    border: 2px solid #00ff88;
    border-radius: 10px;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    color: #00ff88;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.25);
    overflow: hidden;
}

.andershell-terminal::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 40%, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
    mix-blend-mode: multiply;
    z-index: 2;
}

.andershell-terminal::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background-image: radial-gradient(circle at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.45) 80%);
    z-index: 3;
}

.andershell-terminal__scanlines,
.andershell-terminal__ntsc,
.andershell-terminal__bar {
    pointer-events: none;
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.andershell-terminal__scanlines {
    background-image: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.04),
        rgba(255, 255, 255, 0.04) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: screen;
    opacity: 0.45;
    animation: andershellScanlines 5s linear infinite;
}

.andershell-terminal__ntsc {
    background-image: repeating-linear-gradient(
        90deg,
        rgba(0, 255, 170, 0.08),
        rgba(0, 255, 170, 0.08) 2px,
        rgba(0, 120, 255, 0.08) 2px,
        rgba(0, 120, 255, 0.08) 4px,
        rgba(255, 0, 170, 0.08) 4px,
        rgba(255, 0, 170, 0.08) 6px
    );
    mix-blend-mode: color-dodge;
    opacity: 0.18;
    animation: ntscDrift 1.8s linear infinite;
}

.andershell-terminal__bar {
    width: 100%;
    height: 18px;
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.35) 0%, rgba(0, 0, 0, 0) 90%);
    opacity: 0.35;
    animation: barSweep 2.3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    z-index: 4;
}

@keyframes barSweep {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    25% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(320px);
        opacity: 0;
    }
}

@keyframes andershellScanlines {
    from { background-position-y: 0; }
    to { background-position-y: 6px; }
}

@keyframes ntscDrift {
    0% { transform: translateX(0); opacity: 0.12; }
    50% { transform: translateX(-3px); opacity: 0.22; }
    100% { transform: translateX(0); opacity: 0.12; }
}

.andershell-terminal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(0, 255, 136, 0.35);
    margin-bottom: 0.75rem;
}

.andershell-terminal__logo {
    font-weight: 700;
}

.andershell-terminal__output {
    min-height: 260px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.andershell-terminal__output::-webkit-scrollbar {
    width: 6px;
}

.andershell-terminal__output::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.4);
}

.andershell-terminal__message {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    position: relative;
}

.andershell-terminal__message--system {
    color: #8dffef;
    font-style: italic;
}

.andershell-terminal__message--user {
    color: #f2f2f2;
}

.andershell-terminal__message--npc {
    color: #00ffaa;
}

.andershell-terminal__message--error {
    color: #ff4d79;
    font-weight: 600;
}

.andershell-terminal__timestamp {
    color: rgba(255, 255, 255, 0.45);
}

.andershell-terminal__input {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.andershell-terminal__input textarea {
    flex: 1;
    resize: vertical;
    background: rgba(0, 0, 0, 0.6);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.35);
}

.andershell-terminal__input textarea:focus {
    background: rgba(0, 0, 0, 0.85);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.45);
}

.andershell-terminal__typing {
    font-style: italic;
    opacity: 0.7;
}

.andershell-terminal__typing::after {
    content: ' ▌';
    animation: andershellCaret 0.85s steps(2, jump-none) infinite;
}

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