:root {
    /* 品牌色系：摩卡棕 */
    --primary: #885021;
    --primary-hover: #6d3f19;
    --primary-soft: rgba(136, 80, 33, 0.08);
    --primary-ring: rgba(136, 80, 33, 0.2);

    /* 界面基础色 */
    --bg-app: #f8f5f2;
    --bg-card: #ffffff;
    --bg-input: #fcfcfc;
    
    /* 文字颜色 */
    --text-main: #2c2520;
    --text-secondary: #6f6862;
    --text-placeholder: #a8a29e;

    /* 功能色 */
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --success: #10b981;
    --border: #e5e0db;
    
    /* 代码区 */
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;

    /* 布局变量 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 20px -4px rgba(136, 80, 33, 0.05), 0 1px 4px rgba(0,0,0,0.03);
    --shadow-float: 0 10px 30px -5px rgba(0,0,0,0.1);
    
    --container-width: 1280px;
}

/* 基础重置 */
* { box-sizing: border-box; outline: none; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    background: linear-gradient(135deg, #f8f5f2 0%, #fdfbf9 100%);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* --- 整体布局 (Grid System) --- */
.app-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 2rem;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
}

/* 左侧面板 */
.config-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 4rem;
}

/* 右侧面板 (Sticky) */
.preview-panel {
    position: sticky;
    top: 2rem;
    height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

/* 头部 */
.app-header {
    margin-bottom: 1rem;
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}
.logo-area h1 {
    margin: 0;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}
.brand-icon {
    width: 32px;
    height: 32px;
}
.subtitle {
    margin: 0.5rem 0 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* --- 卡片通用样式 --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
}

.card-header, .section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.card-header h2, .section-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.icon-box {
    width: 32px;
    height: 32px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-box svg { width: 18px; height: 18px; }
.icon-box.secondary { background: #f3f4f6; color: #4b5563; }

/* --- 表单元素 --- */
.form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background-color: var(--bg-input);
    transition: all 0.2s ease;
    color: var(--text-main);
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
    background-color: #fff;
}

/* 栅格工具类 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 0.8fr; gap: 1rem; }

/* --- 课程卡片样式 --- */
.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
}

.course-card:hover {
    border-color: #d6cfc9;
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.06);
}

.course-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.course-index {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a8a29e;
    font-weight: 600;
}

.course-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 切换开关 */
.mode-selector {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

.input-mode-switch {
    background: #f3f4f6;
    padding: 3px;
    border-radius: 8px;
    display: inline-flex;
}

.switch-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.switch-btn.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 移除按钮 */
.remove-course-btn {
    background: transparent;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}
.remove-course-btn:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

/* --- 按钮样式 --- */
.btn-primary-dashed {
    width: 100%;
    padding: 1rem;
    border: 2px dashed var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-primary-dashed:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-text {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}
.btn-text:hover { background: #f3f4f6; }
.text-danger { color: var(--danger); }
.text-danger:hover { background: var(--danger-soft); }

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
}
.btn-dark {
    background: var(--primary);
    color: #fff;
}
.btn-dark:hover { background: var(--primary-hover); }

/* --- 提示条 (针对原内容优化) --- */
.notice-banner {
    background: #fff8eb;
    border-left: 4px solid #885021; /* 使用您的品牌色作为左侧强调 */
    color: #594a3d;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.notice-content {
    width: 100%;
}

/* 适配原有 HTML 标签的样式 */
.notice-banner mark {
    background-color: #fde6c3;
    color: #78350f;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
}

.notice-banner a {
    color: #b45309;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dotted #b45309;
}
.notice-banner a:hover { border-bottom-style: solid; }

/* --- JSON 预览区 --- */
.preview-card {
    background: var(--code-bg);
    border-radius: var(--radius-lg);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-float);
    border: 1px solid #333;
}

.preview-header {
    background: #2d2d2d;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.preview-title {
    color: #9ca3af;
    font-size: 0.85rem;
    font-family: 'Monaco', monospace;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.code-dots { display: flex; gap: 6px; }
.code-dots span {
    width: 10px; height: 10px; border-radius: 50%;
    background: #4b5563;
}
.code-dots span:nth-child(1) { background: #ef4444; }
.code-dots span:nth-child(2) { background: #f59e0b; }
.code-dots span:nth-child(3) { background: #10b981; }

.preview-body {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

pre {
    margin: 0;
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
    color: var(--code-text);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
pre::-webkit-scrollbar-thumb { background: #4b5563; }

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

#toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translate(-50%, -100px);
    background: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}
#toast.show { transform: translate(-50%, 0); }

/* --- 响应式适配 --- */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    .preview-panel {
        position: static;
        height: 500px;
        order: 10;
    }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* --- 图片放大模态框 --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 60px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.close-modal:hover,
.close-modal:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}