/* 基础样式和重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* 浅色模式 */
body.light {
    background-color: #f5f5f5;
    color: #333;
}

body.light header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body.light footer {
    background-color: #fff;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

body.light .terminal {
    background-color: #282c34;
    color: #abb2bf;
}

body.light .terminal-input input {
    background-color: transparent;
    color: #abb2bf;
}

body.light .file-explorer {
    background-color: #fff;
    border: 1px solid #ddd;
}

body.light .level-description {
    background-color: #fff;
    border: 1px solid #ddd;
}

body.light .modal-content {
    background-color: #fff;
    color: #333;
}

body.light .level-card {
    background-color: #fff;
    border: 1px solid #ddd;
}

body.light .level-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 深色模式 */
body.dark {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark header {
    background-color: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark footer {
    background-color: #2d2d2d;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.3);
}

body.dark .terminal {
    background-color: #1e1e1e;
    color: #d4d4d4;
}

body.dark .terminal-input input {
    background-color: transparent;
    color: #d4d4d4;
}

body.dark .file-explorer {
    background-color: #2d2d2d;
    border: 1px solid #444;
}

body.dark .level-description {
    background-color: #2d2d2d;
    border: 1px solid #444;
}

body.dark .modal-content {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark .level-card {
    background-color: #2d2d2d;
    border: 1px solid #444;
}

body.dark .level-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #0366d6;
}

#theme-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

#theme-toggle:hover {
    background-color: rgba(0,0,0,0.1);
}

/* 主要内容样式 */
main {
    padding: 2rem 0;
    flex: 1;
}

/* 关卡选择样式 */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.level-card {
    padding: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.level-card:hover {
    transform: translateY(-5px);
}

.level-card h3 {
    margin-bottom: 0.5rem;
}

.level-card p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 游戏容器样式 */
.game-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn {
    background-color: #0366d6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #0256c9;
}

/* 关卡描述样式 */
.level-description {
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
}

.level-description h3 {
    margin-bottom: 1rem;
}

/* 终端样式 */
.terminal-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.terminal-header {
    background-color: #333;
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-title {
    font-size: 0.9rem;
}

.terminal-buttons {
    display: flex;
    gap: 0.5rem;
}

.terminal-button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #555;
}

.terminal-button.close {
    background-color: #ff5f56;
}

.terminal-button.minimize {
    background-color: #ffbd2e;
}

.terminal-button.maximize {
    background-color: #27c93f;
}

.terminal {
    padding: 1rem;
    height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
}

.terminal-output {
    margin-bottom: 0.5rem;
}

.terminal-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prompt {
    color: #50fa7b;
    font-weight: bold;
}

.terminal-input input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
}

/* 文件浏览器样式 */
.file-explorer {
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
}

.file-explorer h3 {
    margin-bottom: 1rem;
}

#file-tree {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.file-tree-item {
    margin-left: 1.5rem;
    position: relative;
}

.file-tree-item:before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    width: 8px;
    height: 1px;
    background-color: #666;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.modal-body {
    padding: 1.5rem;
}

.close-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
}

/* 表格样式 */
#commands-table {
    width: 100%;
    border-collapse: collapse;
}

#commands-table th,
#commands-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#commands-table th {
    font-weight: 600;
}

/* 页脚样式 */
footer {
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
}

footer a {
    color: #0366d6;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 工具类 */
.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-content {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 15px;
    }
    
    nav ul {
        gap: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}