    /* @component Sidebar — 侧边栏
       @state collapsed: 展开300px / 收起64px
       @animation width 0.35s cubic-bezier(0.4, 0, 0.2, 1)
       @gotcha overflow:hidden 会裁剪 fixed 定位子元素 → 考试菜单/右键菜单必须用 position:fixed + portal
       @gotcha 不要用 transform/FLIP 替代 width 过渡 — 已试过全部失败，width 动画虽有 layout 开销但最稳定
    */
    .sidebar {
      height: 100%; background: var(--white); border-right: 1px solid var(--border);
      display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden;
      transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1); position: relative; will-change: width;
    }
    .sidebar .sidebar-text,
    .sidebar .subject-files { transition: opacity 0.25s ease, visibility 0.25s ease; }
    .sidebar.collapsed .sidebar-text {
      opacity: 0; visibility: hidden;
      width: 0; min-width: 0; overflow: hidden; flex-shrink: 1;
      margin: 0 !important; padding: 0 !important;
    }
    .sidebar.collapsed .subject-header { justify-content: center; padding: 0; gap: 0; }
    .sidebar.collapsed .sidebar-header { justify-content: center; padding: 12px 12px; gap: 0; height: 64px; }
    .sidebar.collapsed .sidebar-header-left { justify-content: center; flex: 0 0 auto; gap: 0; }
    .sidebar.collapsed .exam-icon-box { margin: 0; background: transparent; width: 32px; height: 32px; }
    .sidebar.collapsed .exam-switch-btn { width: 0; overflow: hidden; padding: 0; border: none; opacity: 0; visibility: hidden; }
    .sidebar.collapsed .sidebar-nav { padding: 8px 12px; }

    /* 收起态：文件保留文档图标，仅隐藏文字和操作按钮 */
    .sidebar.collapsed .subject-files { opacity: 1; visibility: visible; width: auto; overflow: hidden; }
    .sidebar.collapsed .subject-files:not(.open) { max-height: 0; opacity: 0; }
    .sidebar.collapsed .subject-files.open { max-height: 200px; opacity: 1; }
    .sidebar.collapsed .file-item { padding: 5px 0; justify-content: center; gap: 0; }
    .sidebar.collapsed .file-item .file-name,
    .sidebar.collapsed .file-item .more-btn { display: none; }
    .sidebar.collapsed .file-item .file-icon { width: 20px; height: 20px; opacity: 0.55; }

    .sidebar-header { padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; flex-shrink: 0; height: 64px; }
    .sidebar-header-left { display: flex; align-items: center; gap: 12px; overflow: hidden; white-space: nowrap; flex: 1; min-width: 0; transition: opacity 0.25s; }
    .exam-icon-box { width: 40px; height: 40px; border-radius: 12px; background: var(--alpha-08); display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0; transition: margin 0.35s, width 0.35s, height 0.35s, background 0.35s; }
    .exam-icon-text { font-size: 14px; font-weight: 800; letter-spacing: 0.5px; white-space: nowrap; transition: font-size 0.35s; }
    .sidebar.collapsed .exam-icon-text { font-size: 13px; }
    .exam-name { font-size: 14px; font-weight: 700; color: var(--on-surface); white-space: nowrap; }

    .header-toggle-btn {
      display: inline-flex; align-items: center; gap: 3px; padding: 1px 0; border-radius: 4px;
      border: none; background: transparent; cursor: pointer;
      color: var(--on-surface-variant); font-family: inherit; font-size: 11px;
      transition: all 0.15s; white-space: nowrap; margin-top: 2px;
    }
    .header-toggle-btn .svg-icon { width: 12px; height: 12px; }
    .header-toggle-btn:hover { color: var(--on-surface); }
    .sidebar.collapsed .header-toggle-btn { opacity: 0; visibility: hidden; width: 0; overflow: hidden; padding: 0; margin: 0; }

    .exam-switch-btn {
      width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--border);
      background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center;
      color: var(--on-surface-variant); transition: all 0.2s; flex-shrink: 0;
    }
    .sidebar.collapsed .exam-switch-btn { opacity: 0; visibility: hidden; transition: opacity 0.15s, visibility 0.15s; }
    .exam-switch-btn:hover { background: var(--primary-container); border-color: var(--primary); color: var(--primary); }
    .exam-switch-btn .svg-icon { width: 16px; height: 16px; }

    .divider { height: 1px; background: var(--border); margin: 0 16px; flex-shrink: 0; }
    .sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px; }

    .sidebar-footer {
      border-top: 1px solid var(--border); flex-shrink: 0;
      padding: 12px 16px;
    }
    .footer-main {
      display: flex; align-items: stretch; gap: 8px;
    }
    .footer-left {
      flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    }
    .footer-right {
      flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    }
    .footer-user {
      display: flex; align-items: center; gap: 10px; padding: 6px 0;
      border-radius: 12px; cursor: pointer; transition: background 0.15s;
    }
    .footer-user:hover { background: var(--hover-bg); }
    .footer-avatar {
      width: 36px; height: 36px; border-radius: 50%;
      background: linear-gradient(135deg, var(--primary), var(--primary-muted));
      display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0;
    }
    .footer-user-info { overflow: hidden; }
    .footer-user-name { font-size: 14px; font-weight: 600; color: var(--on-surface); white-space: nowrap; }
    .footer-user-id { font-size: 11px; color: var(--on-surface-variant); white-space: nowrap; }
    .footer-action-btn {
      display: flex; align-items: center; justify-content: flex-start; gap: 6px;
      padding: 7px 0; border-radius: 8px; border: none; background: transparent;
      cursor: pointer; color: var(--on-surface-variant); font-family: inherit;
      font-size: 12px; transition: all 0.15s ease;
    }
    .footer-left .footer-action-btn { padding-left: 8px; }
    .footer-right .footer-action-btn { justify-content: center; padding: 7px 12px; }
    .footer-action-btn:hover { background: var(--hover-bg); color: var(--on-surface); }
    .footer-vip {
      display: flex; flex-direction: column; align-items: center; gap: 2px;
      padding: 6px 8px; border-radius: 8px; border: none; background: transparent;
      cursor: pointer; font-family: inherit; transition: background 0.15s; width: 100%;
    }
    .footer-vip:hover { background: var(--hover-bg); }
    .footer-vip-badge {
      font-size: 10px; color: #b8860b; background: linear-gradient(135deg, #fff8e1, #ffe082);
      padding: 2px 8px; border-radius: 10px; font-weight: 600; letter-spacing: 0.5px;
      white-space: nowrap;
    }
    .footer-vip-expire { font-size: 10px; color: var(--on-surface-variant); white-space: nowrap; }

    /* Collapsed */
    .sidebar.collapsed .sidebar-footer { padding: 12px 12px; }
    .sidebar.collapsed .footer-main { flex-direction: column; align-items: center; gap: 6px; }
    .sidebar.collapsed .footer-left,
    .sidebar.collapsed .footer-right { display: contents; }
    .sidebar.collapsed .footer-user { padding: 0; gap: 0; }
    .sidebar.collapsed .footer-avatar { width: 32px; height: 32px; }
    .sidebar.collapsed .footer-vip { display: none; }
    .sidebar.collapsed .footer-action-btn { width: 32px; height: 32px; padding: 0; gap: 0; justify-content: center; border-radius: 8px; }
    .sidebar.collapsed .footer-left .footer-action-btn,
    .sidebar.collapsed .footer-right .footer-action-btn { padding: 0; gap: 0; }

    .subject-group { margin-bottom: 2px; }

    .subject-header {
      display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
      cursor: pointer; transition: background 0.15s ease, color 0.15s ease; color: var(--on-surface-variant); font-size: 14px; font-weight: 500; white-space: nowrap;
    }
    .subject-header:hover { background: var(--hover-bg); color: var(--on-surface); }
    .subject-header .chevron { transition: transform 0.25s ease; color: var(--outline); margin-left: auto; }
    .subject-header.expanded .chevron { transform: rotate(90deg); }
    .subject-header.active { background: var(--primary-container); color: var(--primary-soft); }
    .subject-header.active .svg-icon { color: var(--primary-soft); }
    .sidebar.collapsed .subject-header.active { background: var(--primary-container); }
    .sidebar.collapsed .subject-header.active .svg-icon { color: var(--primary-soft); }
    .sidebar.collapsed .subject-header.active .chevron { opacity: 0; visibility: hidden; width: 0; }

    .subject-files { overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; max-height: 0; opacity: 0; }
    .subject-files.open { max-height: 400px; opacity: 1; }

    .file-item {
      display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 28px; border-radius: 10px;
      cursor: pointer; transition: all 0.15s ease; color: var(--on-surface-variant); font-size: 13px; position: relative;
      /* V6.72：允许换行——进度条 flex-basis:100% 借此独占一行，
         文件名+菜单按钮留在第一行，进度条像下划线在文件名下方 */
      flex-wrap: wrap;
    }
    .file-item:hover { background: var(--hover-bg); color: var(--on-surface); }
    .file-dot { width: 5px; height: 5px; min-width: 5px; border-radius: 50%; background: var(--outline); flex-shrink: 0; opacity: 0.5; transition: background 0.15s, opacity 0.15s; display: block; }

    .upload-item {
      display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 28px; border-radius: 10px;
      cursor: pointer; transition: all 0.15s ease; color: var(--on-surface-variant); font-size: 13px;
    }
    .upload-item:hover { background: var(--hover-bg); color: var(--on-surface); }
    .upload-item .upload-icon { color: var(--primary); opacity: 0.5; }
    .upload-item:hover .upload-icon { opacity: 0.8; }
    .sidebar.collapsed .upload-item { display: none; }
    .file-item:hover .file-dot { opacity: 0.7; }
    .file-item.active .file-dot { background: var(--primary-soft); opacity: 1; }
    .sidebar.collapsed .file-dot { display: none; }
    .file-item .file-icon { color: var(--primary); opacity: 0.7; transition: opacity 0.15s; }

    .file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
    .file-item.active { background: var(--alpha-10); color: var(--primary-soft); font-weight: 500; }
    .file-item.active .file-icon { color: white; opacity: 1; background: var(--alpha-55); border-radius: 6px; }
    .file-item.active .file-dot { background: var(--primary-soft); opacity: 1; }
    .sidebar.collapsed .file-item.active { background: transparent; }
    .sidebar.collapsed .file-item.active .file-icon { color: white; opacity: 1; background: var(--alpha-55); border-radius: 6px; }
    .sidebar.collapsed .file-item.active .file-dot { display: none; }

    /* Subject first-char circle */
    .subject-char {
      width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
      background: var(--alpha-10); color: var(--primary);
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 700; line-height: 1;
      transition: background 0.15s, color 0.15s;
    }
    .subject-header.active .subject-char { background: var(--primary-soft); color: white; }
    .subject-header:hover .subject-char { background: var(--alpha-18); }
    .subject-header.active:hover .subject-char { background: var(--primary-soft); }
    /* ── 暗夜黑适配：选中科目圆头像白字发糊，改深底 + 浅字 ── */
    [data-theme="dark"] .subject-header.active .subject-char,
    [data-theme="dark"] .subject-header.active:hover .subject-char {
      background: var(--primary-container); color: var(--primary-soft);
    }
    .sidebar.collapsed .subject-char { width: 24px; height: 24px; font-size: 13px; }
    .sidebar.collapsed .subject-group { margin-bottom: 18px; }

    .more-btn {
      width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      color: var(--outline); transition: all 0.15s ease; flex-shrink: 0; opacity: 0;
    }
    .file-item:hover .more-btn { opacity: 1; }
    .more-btn:hover { background: rgba(0,0,0,0.08); color: var(--on-surface); }
    /* @component MainLayout — 主区域容器
       包含: Topbar + Content(AI面板 + 练习区 + 草稿纸层)
       @gotcha .main 是草稿纸 rAF 定位的参照系(getBoundingClientRect)，不是视口
    */
    .main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; position: relative; }
    /* @component Topbar — 顶部导航栏
       @state activeTab: practice | wrong | puzzle | calendar
       @animation Tab切换: 工具栏淡出150ms → FLIP 400ms + 工具栏淡入250ms(延迟150ms)
       @tokens height: 64px
       @gotcha nav-tab.active 有 translateX(-8px) 左移效果
       子组件: NavTabs, Toolbar, Calculator, Timer, FullscreenBtn
    */
    .topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; flex-shrink: 0; height: 64px; box-sizing: border-box; overflow: visible; position: relative; z-index: 16; }
    .nav-tabs { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
    .nav-tab { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 16px; font-size: 14px; font-weight: 500; border: none; background: transparent; cursor: pointer; color: var(--on-surface-variant); transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); font-family: inherit; white-space: nowrap; flex-shrink: 0; }
    .nav-tab:hover { background: var(--hover-bg); color: var(--on-surface); }
    .nav-tab.active { background: var(--primary-soft); color: var(--on-primary); font-weight: 600; box-shadow: 0 2px 8px var(--alpha-30); transform: translateX(-8px); }
    .nav-tab.active:hover { background: var(--primary-soft); color: var(--on-primary); box-shadow: 0 4px 12px var(--alpha-40); }
    /* ── 暗夜黑适配：浅色胶囊 + 白字对比度不足会发糊，改深底 + 浅字 ── */
    [data-theme="dark"] .nav-tab.active {
      background: var(--primary-container); color: var(--primary-soft);
      box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    }
    [data-theme="dark"] .nav-tab.active:hover {
      background: var(--primary-container); color: var(--primary-soft);
      box-shadow: 0 4px 12px rgba(0,0,0,0.45);
    }
