:root {
    --phosphor-green: #4af626;
    --phosphor-amber: #ffb000;
    --danger-red: #ff3300;
    --bg-color: #0a0a0a;
}

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: var(--phosphor-green);
    font-family: "Courier New", Courier, monospace;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* === CRT 特效层 === */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: 
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    opacity: 0.6;
}

/* 屏幕主体 */
.screen {
    width: 98%;
    height: 98%;
    background-color: var(--bg-color);
    border-radius: 10px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
    position: relative;
    overflow: hidden;
    text-shadow: 0 0 4px rgba(74, 246, 38, 0.4); /* 绿色辉光 */
}

/* === 通用组件 === */
input[type="text"] {
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    text-shadow: inherit;
    caret-color: inherit;
}

button {
    background: transparent;
    border: 1px solid var(--phosphor-green);
    color: var(--phosphor-green);
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    text-shadow: inherit;
}

button:hover {
    background: var(--phosphor-green);
    color: var(--bg-color);
}

.hidden { display: none !important; }

.terminal-section {
    display: none;
    height: 100%;
    flex-direction: column;
}

.terminal-section.active {
    display: flex;
}

/* === 登录界面 === */
#login-screen {
    justify-content: center;
    align-items: center;
}

.logo-area pre {
    font-weight: bold;
    line-height: 1.1;
    margin-bottom: 40px;
}

.login-form {
    width: 400px;
    max-width: 90%;
}

.input-line {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(74, 246, 38, 0.3);
    margin-bottom: 10px;
}

.input-line.large {
    font-size: 1.5em;
    margin: 20px 0;
}

.prompt {
    margin-right: 10px;
    font-weight: bold;
}

.system-message {
    min-height: 1.2em;
    color: var(--phosphor-amber);
}

/* === 主终端界面 === */
.terminal-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--phosphor-green);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-weight: bold;
}

#terminal-main {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
}

/* 滚动条样式 */
#terminal-main::-webkit-scrollbar {
    width: 10px;
}
#terminal-main::-webkit-scrollbar-track {
    background: #000;
}
#terminal-main::-webkit-scrollbar-thumb {
    background: var(--phosphor-green);
    border: 2px solid #000;
}

/* === 搜索视图 === */
.view {
    display: none;
    height: 100%;
    flex-direction: column;
}
.view.active {
    display: flex;
}

.welcome-banner {
    margin-bottom: 30px;
    line-height: 1.5;
}

.results-area {
    margin-top: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.result-item {
    padding: 10px;
    border: 1px solid rgba(74, 246, 38, 0.2);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-item:hover {
    background: rgba(74, 246, 38, 0.1);
    border-color: var(--phosphor-green);
}

.result-meta {
    font-size: 0.8em;
    opacity: 0.8;
}

/* === 文档视图 === */
.doc-controls {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-content-wrapper {
    border: 1px solid var(--phosphor-green);
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
    background: rgba(10, 10, 10, 0.8);
}

#doc-title {
    margin-top: 0;
}

.doc-meta {
    margin-bottom: 10px;
    opacity: 0.8;
    font-size: 0.9em;
}

.doc-body {
    line-height: 1.6;
    white-space: pre-wrap; /* 保留文本格式 */
}

/* === 特殊文本效果 === */
.redacted {
    background-color: var(--phosphor-green);
    color: var(--phosphor-green);
    cursor: help;
    transition: background-color 0.3s;
}
.redacted:hover {
    background-color: transparent;
}

.corrupted {
    background-color: #ff3300;
    color: #ff3300;
    cursor: not-allowed;
}
.corrupted:hover {
    background-color: rgba(255, 51, 0, 0.3);
}

.glitch-text {
    color: var(--danger-red);
    font-weight: bold;
    animation: glitch-anim 0.3s infinite;
}

.warning-text {
    color: var(--danger-red);
    text-shadow: 0 0 4px rgba(255, 51, 0, 0.5);
    font-weight: bold;
}

/* 关键词高亮 */
.keyword-highlight {
    color: var(--phosphor-amber);
    text-decoration: underline;
    cursor: pointer;
    transition: all 0.2s;
}
.keyword-highlight:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--phosphor-amber);
}

/* === 理智系统特效 === */
.glitch-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    color: var(--danger-red);
    text-shadow: 0 0 20px rgba(255, 51, 0, 0.8);
    z-index: 1000;
    pointer-events: none;
    animation: glitch-flash 0.2s;
}

.heavy-glitch {
    animation: heavy-glitch-anim 0.1s infinite;
}

@keyframes glitch-anim {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

@keyframes glitch-flash {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

@keyframes heavy-glitch-anim {
    0% { filter: hue-rotate(0deg) brightness(1); }
    25% { filter: hue-rotate(5deg) brightness(1.1); }
    50% { filter: hue-rotate(-5deg) brightness(0.9); }
    75% { filter: hue-rotate(3deg) brightness(1.05); }
    100% { filter: hue-rotate(0deg) brightness(1); }
}

/* 闪烁光标效果 */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === 音效按钮（预留） === */
.sound-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--phosphor-green);
    color: var(--phosphor-green);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9em;
    z-index: 100;
}
.sound-toggle:hover {
    background: var(--phosphor-green);
    color: var(--bg-color);
}