:root {
    --chat-color: #7c3aed;
    --mail-color: #0d9488;
    --sis-color:  #6366f1;
    --wall-color: #f97316;

    --bg-desktop: #0f172a;
    --taskbar-bg: rgba(30, 41, 59, 0.95);
    --window-bg:  #ffffff;
    --text-main:  #f1f5f9;
    --border-color: #334155;
}

* { box-sizing: border-box; user-select: none; }
.lang-cn-only, .lang-en-only { display: none !important; }
body.lang-cn .lang-cn-only { display: inline-block !important; }
body.lang-en .lang-en-only { display: inline-block !important; }
body.lang-cn div.lang-cn-only, body.lang-cn p.lang-cn-only,
body.lang-en div.lang-en-only, body.lang-en p.lang-en-only { display: block !important; }

body {
    margin: 0; padding: 0; width: 100vw; height: 100vh;
    background-color: var(--bg-desktop);
    font-family: 'Segoe UI', system-ui, sans-serif; overflow: hidden; color: var(--text-main);
}

/* 启动屏幕 */
.boot-screen { position: fixed; inset: 0; z-index: 9999; background: #000; color: #e2e8f0; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 0.5s ease; }
.boot-logo { font-size: 4rem; font-weight: 900; margin-bottom: 1rem; border: 4px solid white; padding: 0.5rem 1rem; }
.boot-text { margin-bottom: 20px; font-size: 14px; line-height: 1.6; color: #94a3b8; text-align: center; font-family: monospace; }
.loading-bar { width: 240px; height: 2px; background: #333; }
.progress { width: 0%; height: 100%; background: white; animation: load 1.2s ease forwards; }
@keyframes load { to { width: 100%; } }

/* 桌面与水印 */
.desktop { position: absolute; top: 0; left: 0; right: 0; bottom: 48px; background: radial-gradient(circle at 50% 30%, #1e293b 0%, #020617 100%); }
.watermark { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; pointer-events: none; z-index: 0; opacity: 0.1; color: white; }
.school-logo { font-size: 8rem; font-weight: 900; border: 8px solid white; padding: 1rem 2rem; margin-bottom: 1rem; }
.school-name { font-size: 2rem; font-weight: 300; text-transform: uppercase; }
.school-sub { font-size: 1rem; margin-top: 0.5rem; font-family: monospace; }

/* 窗口 */
.window {
    position: absolute;
    width: 85vw; height: 85vh;
    max-width: 1400px; max-height: 900px;
    min-width: 600px; min-height: 400px; /* 稍微加大最小尺寸 */

    background: var(--window-bg); border-radius: 6px;

    box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.1);
    display: flex; flex-direction: column; overflow: hidden;
}

.title-bar { height: 36px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: white; font-size: 0.9rem; font-weight: 600; }
.win-controls { display: flex; gap: 8px; }
.win-btn { width: 12px; height: 12px; border-radius: 50%; border: none; cursor: pointer; padding: 0; opacity: 0.8; }
.win-btn:hover { opacity: 1; }
.win-btn.close { background: #ef4444; }
.win-btn.min { background: #fbbf24; }
.win-content { flex: 1; position: relative; background: #f8fafc; }
.win-content iframe { width: 100%; height: 100%; border: none; display: block; }
.window.dragging .win-content::after,
.window.resizing .win-content::after {
    content: ''; position: absolute; inset: 0; z-index: 10; cursor: move;
}
.window.resizing .win-content::after { cursor: se-resize; }

/* [新增] 自定义右下角缩放手柄 */
.resize-handle {
    position: absolute;
    bottom: 0; right: 0;
    width: 20px; height: 20px;
    cursor: se-resize; /* 鼠标变成斜向箭头 */
    z-index: 50; /* 关键：层级必须高于 iframe */

    /* 可选：加一个小三角视觉提示 */
    background: linear-gradient(135deg, transparent 50%, #64748b 50%);
    opacity: 0.5;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.resize-handle:hover { opacity: 1; background: linear-gradient(135deg, transparent 50%, #38bdf8 50%); }

/* 侧边栏 */
.sidebar-notes {
    position: absolute; top: 20px; right: 20px; bottom: 20px; width: 280px;
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(12px);
    border: 1px solid var(--border-color); border-radius: 8px;
    display: flex; flex-direction: column; z-index: 10;
    box-shadow: -5px 0 20px rgba(0,0,0,0.2);
}
.notes-header { padding: 15px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; font-weight: 600; color: #f8fafc; }
.notes-toolbar { padding: 10px 15px; display: flex; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.notes-list { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.note-item { background: rgba(0, 0, 0, 0.2); padding: 12px; border-radius: 4px; font-size: 0.9rem; color: #e2e8f0; border-left: 3px solid var(--sis-color); cursor: text; user-select: text; line-height: 1.5; }
.note-item.system-msg { border-left-color: #10b981; font-style: italic; opacity: 0.8; font-size: 0.85rem; }
.btn-sm { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1); color: #cbd5e1; font-size: 12px; padding: 4px 12px; border-radius: 4px; cursor: pointer; }
.btn-sm:hover { background: rgba(255,255,255,0.2); color: white; }
.text-danger:hover { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }

.sidebar-footer {
    padding: 15px; border-top: 1px solid var(--border-color); background: rgba(0, 0, 0, 0.2);
    cursor: pointer; transition: background 0.2s;
}
.sidebar-footer:hover { background: rgba(255, 255, 255, 0.05); }
.progress-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: #94a3b8; margin-bottom: 6px; font-weight: 700; }
.progress-track { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: #2563eb; transition: width 0.5s; }

/* 任务窗口 */
.task-manager-layout { display: flex; flex-direction: column; height: 100%; background: #f1f5f9; color: #1e293b; }
.task-section-main {
    flex: 1;
    display: block;        /* [修改] 原为 flex */
    overflow-y: auto;      /* [修改] 开启整体垂直滚动 */
    overflow-x: hidden;
    position: relative;
}
.task-section-hidden {
    /* [删除] flex: 0 0 auto; */
    /* [删除] border-top... (如果都在一个容器里，边框样式可能需要微调) */
    display: flex;
    flex-direction: column;
    background: #e2e8f0;
    transition: all 0.3s ease;
}
.section-header {
    padding: 10px 12px;     /* [修改] 原为 12px 16px */
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
    background: #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.toggle-header { cursor: pointer; background: #cbd5e1; color: #334155; }
.toggle-header:hover { background: #94a3b8; color: white; }
.toggle-header .arrow { display: inline-block; width: 14px; transition: transform 0.3s; font-size: 0.7rem; }
.task-section-hidden.collapsed .arrow { transform: rotate(0deg); }
.task-section-hidden:not(.collapsed) .arrow { transform: rotate(90deg); }
.hidden-content-wrapper { overflow-y: auto; max-height: 200px; transition: max-height 0.3s ease; }
.task-section-hidden.collapsed .hidden-content-wrapper { max-height: 0; border: none; }
.task-list {
    padding: 8px 12px;
    overflow-y: visible;   /* [修改] 原为 auto，现在不需要它自己滚了 */
    height: auto;          /* [新增] 自适应高度 */
}

.task-item {
    display: flex;
    align-items: flex-start;
    padding: 6px 0;         /* [修改] 原为 8px 0 */
    border-bottom: 1px dashed #e2e8f0;
    font-size: 0.85rem;     /* [修改] 原为 0.9rem，稍微改小一点 */
}
.task-item:last-child { border-bottom: none; }
.task-item input[type="checkbox"] { margin-right: 10px; margin-top: 3px; accent-color: #2563eb; cursor: pointer; }
.task-item label { cursor: pointer; line-height: 1.4; flex: 1; }
.task-item input:checked + label { text-decoration: line-through; color: #94a3b8; }
.badge-count { background: rgba(0,0,0,0.1); padding: 2px 6px; border-radius: 10px; font-size: 0.7rem; }

/* 任务栏 */
.taskbar { position: fixed; bottom: 0; left: 0; right: 0; height: 48px; background: var(--taskbar-bg); border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; z-index: 1000; }
.start-btn { display: flex; align-items: center; padding: 6px 12px; border-radius: 4px; font-weight: 600; font-size: 0.9rem; cursor: pointer; color: white; transition: background 0.2s; }
.start-btn:hover { background: rgba(255,255,255,0.1); }
.app-dock { display: flex; gap: 12px; height: 100%; align-items: center; }
.app-icon { background: none; border: none; position: relative; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.icon-box { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: white; transition: transform 0.2s; }
.app-icon:hover .icon-box { transform: translateY(-4px); background: rgba(255,255,255,0.1); }
.app-icon.active .app-dot { opacity: 1; transform: scale(1); }
.app-dot { width: 4px; height: 4px; background: #38bdf8; border-radius: 50%; position: absolute; bottom: -6px; opacity: 0; transform: scale(0); transition: all 0.2s; }

/* 托盘区域 */
.system-tray { display: flex; align-items: center; gap: 12px; height: 100%; }

/* [新增] 语言切换按钮 */
.tray-icon {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; cursor: pointer; color: #e2e8f0; font-weight: 600; font-size: 0.9rem;
    transition: background 0.2s;
}
.tray-icon:hover { background: rgba(255,255,255,0.1); color: white; }

/* 语言提示文本 */
.lang-hint {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-left: 6px;
    white-space: nowrap;
    opacity: 0.8;
    line-height: 1.2;
}
.lang-hint:hover { opacity: 1; color: #cbd5e1; }


.tray-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.2); }

.tray-info { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; line-height: 1.2; }
.tray-time { font-family: monospace; font-size: 0.95rem; }
.tray-role { font-size: 0.7rem; opacity: 0.7; letter-spacing: 0.5px; }

/* === Sidebar Tabs === */
.sidebar-tabs {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border-color);
}
.sidebar-tab {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}
.sidebar-tab:hover { color: #cbd5e1; background: rgba(255,255,255,0.05); }
.sidebar-tab.active { color: white; border-bottom-color: var(--chat-color); background: rgba(255,255,255,0.05); }

/* === Sidebar Panels === */
.sidebar-panel {
    display: none; /* 默认隐藏 */
    flex: 1;
    flex-direction: column;
    overflow: hidden; /* 防止撑开 */
    height: 100%; /* 占满剩余高度 */
}
.sidebar-panel.active {
    display: flex;
}

/* === Decoder Tools === */
.decoder-container {
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 10px;
}
.decoder-input {
    width: 100%;
    height: 100px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    color: #e2e8f0;
    font-family: monospace;
    font-size: 0.85rem;
    resize: none;
    outline: none;
}
.decoder-input:focus { border-color: var(--chat-color); }

.decoder-controls { display: flex; gap: 8px; }
.decoder-select {
    flex: 2;
    background: #1e293b;
    color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px;
    outline: none;
}
.decoder-num {
    width: 50px;
    background: #1e293b;
    color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px;
    text-align: center;
}

.decoder-label { font-size: 0.75rem; color: #94a3b8; font-weight: 700; margin-top: 5px; }
.decoder-output {
    flex: 1;
    background: rgba(16, 185, 129, 0.1);
    border: 1px dashed #10b981;
    border-radius: 6px;
    padding: 10px;
    color: #10b981;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    overflow-y: auto;
    user-select: text;
}

/* os-style.css 新增部分 */

/* === 章节分割栏样式 === */
.task-chapter-header {
    background: #f1f5f9;
    color: #64748b;
    padding: 6px 12px;      /* [修改] 原为 8px 12px */
    font-size: 0.75rem;     /* [修改] 字体改小，更精致 */
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    margin-top: -1px;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* 隐藏部分的第一章标题去掉上边框 */
.task-chapter-header:first-child {
    border-top: none;
}
/* os-style.css 修改与新增 */

/* 1. 章节标题样式升级 */
.task-chapter-header {
    background: #f1f5f9;
    color: #64748b;
    padding: 8px 12px; /* 稍微调回一点高度方便点击 */
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    margin-top: -1px;

    /* 关键：设置为 sticky，但现在配合折叠使用体验更好 */
    position: sticky;
    top: 0;
    z-index: 5;

    /* [新增] 交互样式 */
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}

.task-chapter-header:hover {
    background: #e2e8f0;
    color: #334155;
}

/* 2. 箭头动画 */
.task-chapter-header .arrow {
    display: inline-block;
    margin-right: 6px;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    transform: rotate(0deg); /* 默认展开状态(向下) */
}

/* 3. 折叠逻辑 */
/* 当容器被加上 .collapsed 类时 */
.chapter-wrapper.collapsed .chapter-list {
    display: none; /* 隐藏列表 */
}

.chapter-wrapper.collapsed .task-chapter-header .arrow {
    transform: rotate(-90deg); /* 箭头转向右侧，表示折叠 */
}

.chapter-wrapper.collapsed .task-chapter-header {
    border-bottom: 1px solid #e2e8f0; /* 保持底边框 */
}

/* os-style.css */

/* [新增] 任务目标警告卡片 */
.task-alert-card {
    background: #fff1f2;       /* 浅粉背景 */
    border: 1px solid #fecdd3; /* 深粉边框 */
    border-radius: 6px;        /* 圆角 */
    margin: 10px 12px 5px 12px;/* 四周留白，不再紧贴标题 */
    padding: 10px;
    box-shadow: 0 2px 4px rgba(225, 29, 72, 0.05); /* 轻微阴影 */
}

/* 调整里面的文字间距 */
.task-alert-title {
    font-weight: 700;
    color: #be123c;
    font-size: 0.85rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-alert-body {
    font-size: 0.85rem;
    color: #881337;
    line-height: 1.4;
}


@media (max-width: 768px) {
    .window { width: 100% !important; height: calc(100% - 48px) !important; top: 0 !important; left: 0 !important; border-radius: 0; }
    .sidebar-notes { display: none; }
    .win-controls .min { display: none; }
}

/* === 引导弹窗样式 === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5); /* 半透明遮罩 */
    z-index: 9999; /* 确保在最上层 */
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px); /* 轻微模糊背景 */
}

/* 按钮通用样式 */
.btn-primary, .btn-secondary {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.btn-primary {
    background: #2563eb; /* 蓝色主按钮 */
    color: white;
}

.btn-secondary {
    background: #e2e8f0; /* 灰色次按钮 */
    color: #475569;
}

.btn-primary:hover, .btn-secondary:hover {
    opacity: 0.9;
}