:root {
    --bg-color: #0d1117;
    --sidebar-bg: #161b22;
    --card-bg: #21262d;
    --border-color: #30363d;
    --accent-color: #58a6ff;
    --success-color: #238636;
    --danger-color: #da3633;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 登录页样式 */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-card {
    background: var(--sidebar-bg);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* 主布局 */
#main-container {
    display: none;
    /* 初始隐藏 */
    width: 100%;
    height: 100%;
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
}

.sidebar-brand {
    padding: 0 1.5rem 1.5rem;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.nav-item {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-color);
    border-right: 3px solid var(--accent-color);
}

.content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* 基础组件 */
input[type="text"],
input[type="password"] {
    background: #010409;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    width: 100%;
    margin-bottom: 1rem;
}

button {
    background: #21262d;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

button.primary {
    background: var(--success-color);
    color: white;
}

button.primary:hover {
    background: #2ea043;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.loading-dots::after {
    content: '...';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0% {
        content: '.';
    }

    33% {
        content: '..';
    }

    66% {
        content: '...';
    }
}

/* 增强按钮样式 */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border: none;
    flex: 1;
    transition: background 0.2s;
}

.btn-action:hover {
    filter: brightness(1.15);
}

.btn-action:active {
    opacity: 0.8;
}

.btn-action svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.btn-summary {
    background: #0969da;
    color: white;
}

.btn-logs {
    background: #30363d;
    color: var(--text-primary);
}

.btn-stop {
    background: #da3633;
    color: white;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* 状态徽章 */
.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-live {
    background: #388bfd33;
    color: #58a6ff;
}

.badge-demo {
    background: #f0f6fc1a;
    color: #8b949e;
}

.badge-running {
    background: #23863633;
    color: #3fb950;
}

/* 详情展示 */
footer {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
}

#mini-network-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.list-item:last-child {
    border-bottom: none;
}

.logs-pre {
    background: #010409;
    padding: 1rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.8rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    white-space: pre-wrap;
    color: #d1d5da;
}

/* Markdown 渲染样式 */
.markdown-content {
    line-height: 1.6;
    color: var(--text-primary);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 10px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3rem;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-content th,
.markdown-content td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.markdown-content th {
    background: var(--sidebar-bg);
    color: var(--accent-color);
}

.markdown-content tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.markdown-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-secondary);
}

.markdown-content code {
    background: #010409;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-color);
    width: 90%;
    max-width: 900px;
    height: 80vh;
    max-height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}