:root {
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --text-primary: #33ff33;
    --text-primary-shadow: #33ff33;
    --text-secondary: #22cc22;
    --text-dim: #118811;
    --text-error: #ff4444;
    --text-warning: #ffaa00;
    --text-info: #00aaff;
    --border-color: #333;
    --accent: #33ff33;
    --crt-flicker: 0.97;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', Courier, monospace;
    background: #000;
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    text-shadow: 0 0 2px var(--text-primary-shadow);
}

.terminal-container {
    width: 100%;
    height: 100vh;
    background: var(--bg-primary);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* CRT Screen Effects */
.terminal-container::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.1) 50%  /* 0.25 -> 0.1 (减弱黑线) */
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.03),  /* 0.06 -> 0.03 (减弱红色) */
        rgba(0, 255, 0, 0.01),  /* 0.02 -> 0.01 (减弱绿色) */
        rgba(0, 0, 255, 0.03)   /* 0.06 -> 0.03 (减弱蓝色) */
    );
    z-index: 100;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.terminal-container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.02; }
    5% { opacity: 0.05; }
    10% { opacity: 0.02; }
    15% { opacity: 0.06; }
    20% { opacity: 0.02; }
    25% { opacity: 0.02; }
    30% { opacity: 0.02; }
    35% { opacity: 0.01; }
    40% { opacity: 0.02; }
    45% { opacity: 0.05; }
    50% { opacity: 0.02; }
    55% { opacity: 0.05; }
    60% { opacity: 0.02; }
    65% { opacity: 0.04; }
    70% { opacity: 0.02; }
    75% { opacity: 0.02; }
    80% { opacity: 0.04; }
    85% { opacity: 0.02; }
    90% { opacity: 0.05; }
    95% { opacity: 0.02; }
    100% { opacity: 0.05; }
}

@keyframes textShadow {
    0% { text-shadow: 0.4389924193300864px 0 1px rgba(0,30,255,0.5), -0.4389924193300864px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    5% { text-shadow: 2.7928974010788217px 0 1px rgba(0,30,255,0.5), -2.7928974010788217px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    10% { text-shadow: 0.02956275843481219px 0 1px rgba(0,30,255,0.5), -0.02956275843481219px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    15% { text-shadow: 0.4021853855287816px 0 1px rgba(0,30,255,0.5), -0.4021853855287816px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    20% { text-shadow: 3.4794037899852017px 0 1px rgba(0,30,255,0.5), -3.4794037899852017px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    25% { text-shadow: 1.612563040114954px 0 1px rgba(0,30,255,0.5), -1.612563040114954px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    30% { text-shadow: 0.7015590085143956px 0 1px rgba(0,30,255,0.5), -0.7015590085143956px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    35% { text-shadow: 3.896914047650351px 0 1px rgba(0,30,255,0.5), -3.896914047650351px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    40% { text-shadow: 3.870905614848819px 0 1px rgba(0,30,255,0.5), -3.870905614848819px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    45% { text-shadow: 2.231056963361899px 0 1px rgba(0,30,255,0.5), -2.231056963361899px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    50% { text-shadow: 0.08084290417898504px 0 1px rgba(0,30,255,0.5), -0.08084290417898504px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    55% { text-shadow: 2.3758461067427543px 0 1px rgba(0,30,255,0.5), -2.3758461067427543px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    60% { text-shadow: 2.202193051050636px 0 1px rgba(0,30,255,0.5), -2.202193051050636px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    65% { text-shadow: 2.8638780614874975px 0 1px rgba(0,30,255,0.5), -2.8638780614874975px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    70% { text-shadow: 0.48874025155497314px 0 1px rgba(0,30,255,0.5), -0.48874025155497314px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    75% { text-shadow: 1.8948491305757957px 0 1px rgba(0,30,255,0.5), -1.8948491305757957px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    80% { text-shadow: 0.0833037308038857px 0 1px rgba(0,30,255,0.5), -0.0833037308038857px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    85% { text-shadow: 0.09769827255241735px 0 1px rgba(0,30,255,0.5), -0.09769827255241735px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    90% { text-shadow: 3.443339761481782px 0 1px rgba(0,30,255,0.5), -3.443339761481782px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    95% { text-shadow: 2.1841838852799786px 0 1px rgba(0,30,255,0.5), -2.1841838852799786px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    100% { text-shadow: 2.6208764473832513px 0 1px rgba(0,30,255,0.5), -2.6208764473832513px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
}

.terminal-header {
    display: none;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
    margin-right: 15px;
}

.btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.btn-close {
    background: #ff5f56;
}

.btn-minimize {
    background: #ffbd2e;
}

.btn-maximize {
    background: #27c93f;
}

.terminal-title {
    color: var(--text-dim);
    font-size: 14px;
    flex: 1;
    text-align: center;
}

.terminal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    font-size: 14px;
    line-height: 1.6;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* 自定义滚动条 */
.terminal-body::-webkit-scrollbar {
    width: 10px;
}

.terminal-body::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.terminal-body::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 5px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.boot-sequence {
    margin-bottom: 20px;
}

.boot-line {
    color: var(--text-dim);
    margin: 5px 0;
    animation: typing 0.5s steps(40, end);
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.ascii-art {
    color: var(--text-secondary);
    margin: 20px 0;
    font-size: 10px;
    line-height: 1.2;
    overflow-x: auto;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.welcome-message {
    margin: 20px 0;
    color: var(--text-secondary);
}

.welcome-message p {
    margin: 8px 0;
}

.highlight {
    color: var(--accent);
    font-weight: bold;
    padding: 2px 6px;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 3px;
}

#output {
    margin: 20px 0;
}

.output-line {
    margin: 5px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.command-echo {
    color: var(--text-primary);
    margin: 15px 0 5px 0;
}

.command-echo .prompt {
    color: var(--text-secondary);
}

.output-text {
    color: var(--text-secondary);
    margin: 5px 0;
}

.output-error {
    color: var(--text-error);
}

.output-warning {
    color: var(--text-warning);
}

.output-info {
    color: var(--text-info);
}

.output-success {
    color: var(--accent);
}

.input-line {
    display: flex;
    align-items: center;
    margin-top: 20px;
}

.prompt {
    color: var(--text-secondary);
    margin-right: 8px;
    font-weight: bold;
    white-space: nowrap;
}

.command-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    caret-color: var(--accent);
}

.command-input::selection {
    background: rgba(0, 255, 0, 0.3);
}

/* 文件列表样式 */
.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.file-item {
    color: var(--text-secondary);
}

.file-item.directory {
    color: var(--text-info);
    font-weight: bold;
}

.file-item.hidden {
    color: var(--text-dim);
}

.file-item.executable {
    color: var(--accent);
    font-weight: bold;
}

/* 表格样式 */
.table {
    width: 100%;
    margin: 10px 0;
}

.table-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    margin: 5px 0;
}

.table-header {
    color: var(--text-info);
    font-weight: bold;
}

.table-cell {
    padding: 5px;
}

/* 加密文本样式 */
.encrypted-text {
    color: var(--text-warning);
    letter-spacing: 2px;
    font-family: monospace;
    background: rgba(255, 170, 0, 0.1);
    padding: 10px;
    border-left: 3px solid var(--text-warning);
    margin: 10px 0;
}

/* 链接样式 */
a {
    color: var(--text-info);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-info);
}

a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .terminal-container {
        width: 100%;
        height: 100vh;
    }
    
    .terminal-body {
        font-size: 12px;
        padding: 15px;
    }
    
    .ascii-art {
        font-size: 6px;
        overflow-x: auto;
    }
    
    .file-list {
        grid-template-columns: 1fr;
    }
    
    .table-row {
        grid-template-columns: 100px 1fr;
        font-size: 12px;
    }
    
    .command-input {
        font-size: 12px;
    }
    
    /* 防止iOS自动缩放 */
    input {
        font-size: 12px !important;
    }
}

@media (max-width: 480px) {
    .terminal-header {
        padding: 8px 10px;
    }
    
    .terminal-title {
        font-size: 12px;
    }
    
    .btn {
        width: 10px;
        height: 10px;
    }
    
    .terminal-body {
        font-size: 11px;
        padding: 10px;
    }
    
    .ascii-art {
        font-size: 5px;
    }
}

/* 打印动画 */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--accent);
    animation: blink 1s infinite;
    margin-left: 2px;
}

/* 特殊样式 */
.secret-hint {
    color: var(--text-dim);
    font-style: italic;
    opacity: 0.6;
}

.achievement {
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 10px;
    margin: 10px 0;
    background: rgba(0, 255, 0, 0.05);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
    }
}

/* 代码块样式 */
.code-block {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--accent);
    padding: 10px;
    margin: 10px 0;
    overflow-x: auto;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 终端崩溃动画效果 */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

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