/* 基础重置 */
*, :after, :before {
    box-sizing: border-box;
    border: 0 solid #eee;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background: #001100;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* 终端容器 */
.terminal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #001100;
    padding: 1.5rem;
    overflow: hidden;
}

.terminal {
    flex: 1;
    position: relative;
    width: 86ch;  /* 固定宽度为84字符 */
    max-height: calc(100vh - 3rem);  /* 减去padding空间 */
    color: #4AF626;
    font-size: min(calc(160vw / 84), 20px);  /* 动态计算字体大小 */
    line-height: 1.6;
    letter-spacing: 0.05em;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 20px;
    background: #001100;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 隐藏 Webkit 滚动条 */
.terminal::-webkit-scrollbar {
    display: none;
}

/* 全局扫描线效果 */
.terminal::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    background: linear-gradient(
        to bottom,
        rgba(74, 246, 38, 0.15) 0%,
        rgba(74, 246, 38, 0.15) 50%,
        rgba(0, 0, 0, 0.15) 50%,
        rgba(0, 0, 0, 0.15) 100%
    );
    background-size: 100% 3px;
    pointer-events: none;
    animation: scanlines 8s linear infinite;
    opacity: 0.5;
    mix-blend-mode: overlay;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(3px); }
}

/* CRT 显示器效果 */
.terminal::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        circle at center,
        rgba(74, 246, 38, 0.1) 0%,
        rgba(0, 17, 0, 0.3) 80%,
        rgba(0, 17, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* 终端输出区域 */
.terminal-output,
.terminal-line,
.command-output,
.prompt,
.terminal-input-display {
    position: relative;
    text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                 0 0 20px rgba(74, 246, 38, 0.7),
                 0 0 30px rgba(74, 246, 38, 0.4);
    opacity: 0.95;
    font-weight: 500;
    color: #4AF626;
    user-select: text;
    white-space: pre-wrap;       /* 允许自动换行 */
    word-wrap: break-word;       /* 长单词换行 */
    word-break: break-word;      /* 确保所有内容都会换行 */
    max-width: 100%;             /* 限制最大宽度 */
}

.terminal-output {
    margin-bottom: 20px;
    white-space: pre-wrap;
}

/* 输入行 */
.terminal-input-line {
    display: flex;
    align-items: center;
    padding: 5px 0;
    position: relative;
    background: transparent;
    margin-top: 5px;
}

/* 提示符样式 */
.prompt {
    color: #4AF626;
    margin-right: 8px;
    user-select: none;
    opacity: 1;
    flex-shrink: 0;
}

/* 输入框包装器 */
.terminal-input-wrapper {
    flex: 1;
    position: relative;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    overflow: hidden;  /* 防止内容溢出 */
}

/* 输入显示区域 */
.terminal-input-display {
    flex: 1;
    min-height: 1.2em;
    white-space: pre;
    color: #4AF626;
    text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                 0 0 20px rgba(74, 246, 38, 0.7),
                 0 0 30px rgba(74, 246, 38, 0.4);
    overflow-x: auto;  /* 允许水平滚动 */
    overflow-y: hidden;  /* 禁止垂直滚动 */
    scrollbar-width: none;  /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

/* 隐藏 Webkit 滚动条 */
.terminal-input-display::-webkit-scrollbar {
    display: none;
}

/* 输入框样式 */
.terminal-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: transparent;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    caret-color: transparent;  /* 隐藏系统光标 */
    -webkit-tap-highlight-color: transparent;  /* 移除点击高亮 */
    opacity: 0;  /* 使输入框完全透明 */
}

/* 在移动设备上隐藏系统光标 */
@media (hover: none) and (pointer: coarse) {
    .terminal-input {
        font-size: 1px;  /* 极小的字体大小 */
        transform: scale(0);  /* 缩放到0 */
        transform-origin: left;  /* 从左侧开始缩放 */
    }
}

/* 闪烁光标 */
.cursor {
    position: absolute;
    width: 0.6em;
    height: 1.2em;
    background: #4AF626;
    margin-left: 1px;
    animation: blink 1s step-end infinite;
    box-shadow: 0 0 10px rgba(74, 246, 38, 1),
                0 0 20px rgba(74, 246, 38, 0.7),
                0 0 30px rgba(74, 246, 38, 0.4);
    pointer-events: none;  /* 确保光标不会影响点击事件 */
}

@keyframes blink {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.95; }
}

/* 字符闪烁效果 */
@keyframes charFlash {
    0% { 
        opacity: 1;
        text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                     0 0 20px rgba(74, 246, 38, 0.7);
    }
    50% { 
        opacity: 0.7;
        text-shadow: 0 0 15px rgba(74, 246, 38, 1),
                     0 0 30px rgba(74, 246, 38, 0.7);
    }
    100% { 
        opacity: 1;
        text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                     0 0 20px rgba(74, 246, 38, 0.7);
    }
}

.char-flash {
    animation: charFlash 0.15s ease-out forwards;
    display: inline-block;
}

/* 命令输出动画 */
.command-output {
    margin: 5px 0;
    opacity: 0;
    position: relative;
    min-height: 1.2em;
    animation: textAppear 0.3s ease-out forwards;
    padding-right: 10px;         /* 添加右侧padding防止文字贴边 */
    white-space: pre-wrap;       /* 允许自动换行 */
    word-wrap: break-word;       /* 长单词换行 */
    word-break: break-word;      /* 确保所有内容都会换行 */
}

@keyframes textAppear {
    0% { 
        opacity: 0;
        transform: translateY(-2px);
    }
    100% { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* 命令输出中的粗体文本样式 */
.command-output strong, .command-output b {
    font-weight: 600;
    font-size: 1.1em;  /* 比普通文本大 10% */
    letter-spacing: 0.02em;  /* 稍微增加字母间距 */
}

/* 命令输出中的标题样式 */
.command-output h2 {
    font-weight: 700;
    font-size: 1.3em;  /* 比普通文本大 30% */
    letter-spacing: 0.03em;
    margin: 0.5em 0;
    text-decoration: underline;
}

.command-output h3 {
    font-weight: 600;
    font-size: 1.2em;  /* 比普通文本大 20% */
    letter-spacing: 0.02em;
    margin: 0.5em 0;
    text-decoration: underline;
}

/* 命令输出中的斜体文本样式 */
.command-output i {
    font-style: italic;
}

/* 终端行 */
.terminal-line {
    position: relative;
    white-space: pre;
    opacity: 0;
    animation: lineAppear 0.15s ease-out forwards;
    margin: 5px 0;
    display: flex;
    align-items: flex-start;
}

/* 静态终端行（不使用动画） */
.terminal-line.static {
    opacity: 1;
    animation: none;
}

.terminal-line .prompt {
    flex-shrink: 0;
    margin-right: 8px;
}

@keyframes lineAppear {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 字符闪烁效果 */
.command-output:last-child {
    animation: textGlow 0.1s ease-out;
}

@keyframes textGlow {
    0% { text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                      0 0 20px rgba(74, 246, 38, 0.7),
                      0 0 30px rgba(74, 246, 38, 0.4); }
    50% { text-shadow: 0 0 15px rgba(74, 246, 38, 1),
                       0 0 30px rgba(74, 246, 38, 0.8),
                       0 0 45px rgba(74, 246, 38, 0.6); }
    100% { text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                        0 0 20px rgba(74, 246, 38, 0.7),
                        0 0 30px rgba(74, 246, 38, 0.4); }
}

/* 终端行动画 */
.terminal-line {
    animation: dream 0.5s ease-in;
    position: relative;
    white-space: pre-wrap;
}

@keyframes dream {
    0% {
        opacity: 0;
        filter: blur(4px);
    }
    to {
        opacity: 0.95;
        filter: blur(0);
    }
    0%, to {
        transform: translateX(0);
        transform-origin: 50% 50%;
    }
    15% {
        transform: translateX(-4px) skew(-20deg);
    }
    30% {
        transform: translateX(calc(3px)) skew(20deg);
    }
    45% {
        transform: translateX(calc(-2px)) skew(calc(-20deg / 1.8));
    }
    60% {
        transform: translateX(calc(2px)) skew(calc(20deg / 3));
    }
    75% {
        transform: translateX(calc(-1px)) skew(calc(-20deg / 5));
    }
}

/* 自定义滚动条 */
.terminal::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.terminal:hover::-webkit-scrollbar,
.terminal::-webkit-scrollbar-thumb {
    opacity: 1;
}

.terminal::-webkit-scrollbar-track {
    background: rgba(0, 17, 0, 0.3);
    opacity: 0;
}

.terminal::-webkit-scrollbar-thumb {
    background: rgba(74, 246, 38, 0.3);
    border-radius: 4px;
    transition: background 0.2s;
}

.terminal::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 246, 38, 0.5);
}

/* 版权信息 */
.copyright {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 12px;
    opacity: 0.7;
    text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                 0 0 20px rgba(74, 246, 38, 0.7);
    z-index: 3;
    color: #4AF626;
    white-space: nowrap;  /* 版权信息不换行 */
}

.copyright a {
    color: inherit;
    text-decoration: none;
}

.copyright a:hover {
    text-decoration: underline;
}

/* CRT 噪点效果 */
.terminal-container::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0Inkq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xifFjJpY2Xl5zXdguFqYyTR1zSp1Y9p+tktDYYSNflcxI0iyO4TPBdlRcpeqjK/piF5bklq77VSEaA+z8qmJTFzIWiitbnzR794USKBUaT0NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==");
    opacity: 0.05;
    pointer-events: none;
    mix-blend-mode: screen;
    animation: noise 0.2s infinite;
}

@keyframes noise {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-1px, -1px); }
    20% { transform: translate(1px, 1px); }
    30% { transform: translate(-1px, 1px); }
    40% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 0); }
    60% { transform: translate(1px, 0); }
    70% { transform: translate(0, 1px); }
    80% { transform: translate(0, -1px); }
    90% { transform: translate(1px, -1px); }
}

/* 分割线 */
.separator {
    height: 1px;
    background: linear-gradient(
        to right,
        rgba(74, 246, 38, 0) 0%,
        rgba(74, 246, 38, 0.3) 50%,
        rgba(74, 246, 38, 0) 100%
    );
    margin: 10px 0;
    opacity: 0.5;
}

/* 补全框样式 */
.completion-box {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #0f0;
    padding: 5px;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 5px;
    z-index: 10;
}

.completion-item {
    padding: 2px 5px;
    color: #0f0;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
}

.completion-item.selected {
    background: #0f0;
    color: #000;
}

/* 自定义补全框滚动条 */
.completion-box::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.completion-box::-webkit-scrollbar-track {
    background: rgba(0, 17, 0, 0.3);
}

.completion-box::-webkit-scrollbar-thumb {
    background: rgba(74, 246, 38, 0.3);
    border-radius: 3px;
}

.completion-box::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 246, 38, 0.5);
}

/* 目录和文件显示样式 */
.directory {
    color: #4AF626;
    font-weight: bold;
}

.file {
    color: #4AF626;
}

/* 命令链接样式 */
.command-link {
    color: #4AF626;
    cursor: pointer;
    position: relative;
    background: rgba(74, 246, 38, 0.1);
    padding: 0 4px;
    margin: 0 -4px;
    transition: all 0.2s ease;
    text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                 0 0 20px rgba(74, 246, 38, 0.7),
                 0 0 30px rgba(74, 246, 38, 0.4);
}

/* 目录链接样式 */
.command-link.dir-link {
    font-weight: bold;
    letter-spacing: 0.05em;
}

/* txt文件链接样式 */
.command-link.txt-link {
    font-style: normal;
    letter-spacing: 0.02em;
}

/* pdf文件链接样式 */
.command-link.pdf-link {
    font-style: italic;
    letter-spacing: 0.02em;
}

.command-link:hover {
    color: #000000;
    background: #4AF626;
    text-shadow: none;
    box-shadow: 0 0 8px rgba(74, 246, 38, 0.8),
                0 0 16px rgba(74, 246, 38, 0.5);
}

/* 添加扫描线效果 */
.command-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(74, 246, 38, 0.07) 0%,  /* 降低扫描线亮度 */
        rgba(74, 246, 38, 0.07) 50%,
        transparent 50%,
        transparent 100%
    );
    background-size: 100% 4px;
    pointer-events: none;
    animation: linkScan 8s linear infinite;
}

@keyframes linkScan {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* ASCII art 样式 */
.ascii-art {
    line-height: 0.85;  /* 显著减小行间距 */
    font-size: 1em;   /* 稍微缩小字体 */
    margin: -0.3em 0;   /* 使用负边距来减少行间距 */
    padding: 0;
    white-space: pre;
    font-family: 'IBM Plex Mono', monospace;
    display: block;
    letter-spacing: 0;  /* 移除字母间距 */
    height: 0em;        /* 固定高度 */
    overflow: visible;  /* 允许内容溢出 */
}

/* 外部链接样式 */
.external-link {
    color: #4AF626;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    padding: 0 2px;
    transition: all 0.2s ease;
}

.external-link:hover {
    color: #000000;
    background: #4AF626;
    text-decoration: none;
    text-shadow: none;
    box-shadow: 0 0 8px rgba(74, 246, 38, 0.8);
    border-radius: 2px;
}

/* 作者名字高亮样式 */
.author-highlight {
    color: #4AF626;
    font-weight: bold;
    background: rgba(74, 246, 38, 0.1);
    padding: 0 4px;
    margin: 0 -4px;
    text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                 0 0 20px rgba(74, 246, 38, 0.7),
                 0 0 30px rgba(74, 246, 38, 0.4);
    position: relative;
}

/* 作者名字高亮扫描线效果 */
.author-highlight::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(74, 246, 38, 0.07) 0%,
        rgba(74, 246, 38, 0.07) 50%,
        transparent 50%,
        transparent 100%
    );
    background-size: 100% 4px;
    pointer-events: none;
    animation: linkScan 8s linear infinite;
}

/* 选中文本时保持光晕效果 */
::selection {
    background: rgba(74, 246, 38, 0.3);
    color: #4AF626;
    text-shadow: 0 0 10px rgba(74, 246, 38, 1),
                 0 0 20px rgba(74, 246, 38, 0.7),
                 0 0 30px rgba(74, 246, 38, 0.4);
} 