:root {
    --editor-bg: #1e1e1e;
    --line-color: #858585;
    --text-color: #d4d4d4;
    --keyword-color: #569cd6;
    --string-color: #ce9178;
    --comment-color: #6a9955;
    --number-color: #b5cea8;
    --font-family: 'Consolas', 'Monaco', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--editor-bg);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.editor {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: var(--editor-bg);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.editor-header {
    background: #2d2d2d;
    padding: 10px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.close { background: #ff5f56; }
.minimize { background: #ffbd2e; }
.maximize { background: #27c93f; }

.title-bar {
    color: #858585;
    margin-left: 20px;
    font-size: 0.9em;
}

.editor-content {
    padding: 20px;
    counter-reset: line;
    font-size: 14px;
    overflow-x: auto;
}

.line {
    display: flex;
    padding: 2px 0;
    position: relative;
    min-height: 1.6em;
}

.line::before {
    counter-increment: line;
    content: counter(line);
    color: var(--line-color);
    width: 2em;
    text-align: right;
    padding-right: 1em;
    position: absolute;
}

.line-content {
    padding-left: 3em;
    width: 100%;
}

.indent { margin-left: 2em; }
.indent-2 { margin-left: 4em; }

.keyword { color: var(--keyword-color); }
.string { color: var(--string-color); }
.comment { color: var(--comment-color); }
.number { color: var(--number-color); }

a {
    color: #4ec9b0;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #66d9cb;
    text-decoration: underline;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #fff;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
    vertical-align: middle;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .editor {
        width: 100%;
        margin: 0;
        font-size: 14px;
    }

    .editor-content {
        padding: 15px 10px;
    }

    .line-content {
        padding-left: 2.5em;
    }


    .indent { margin-left: 1.5em; }
    .indent-2 { margin-left: 3em; }

    .title-bar {
        font-size: 0.8em;
        margin-left: 10px;
    }

    .window-btn {
        width: 10px;
        height: 10px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 320px) {
    .editor-content {
        font-size: 12px;
    }

    .indent { margin-left: 1em; }
    .indent-2 { margin-left: 2em; }
}