/* ============================================================
   SolidPhysics Virtual Lab — 三栏布局 · 响应式优化
   1920×1080 / 1440×900 / 1366×768
   ============================================================ */

#mindmap {
    position: absolute; top: 52px; right: 0; bottom: 0; left: 0; z-index: 1;
    display: flex;
    background: radial-gradient(ellipse at 50% 30%, #0a1628 0%, #050510 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ============================================================
   三栏布局 （>= 1600px 宽屏）
   ============================================================ */

/* 左侧导航 */
.mm-sidebar {
    width: 220px; flex-shrink: 0; overflow-y: auto;
    background: rgba(10, 14, 26, 0.4);
    border-right: 1px solid rgba(42, 58, 92, 0.12);
    padding: 16px 0;
}
.mm-title { font-size: 13px; font-weight: 700; color: #8899b0; padding: 0 20px 14px; letter-spacing: 1px; }
.mm-cat-header {
    padding: 8px 20px; font-size: 13px; font-weight: 700; color: #8899b0;
    cursor: pointer; transition: all 0.15s; user-select: none;
    letter-spacing: 0.5px;
}
.mm-cat-header:hover { color: #d0d8e8; background: rgba(59,130,246,0.05); }
.mm-cat-list { padding: 0 8px 8px; }
.mm-item {
    padding: 6px 14px 6px 24px; font-size: 12px; color: #5a6a80;
    cursor: pointer; border-radius: 5px; transition: all 0.15s; margin: 1px 0; user-select: none;
}
.mm-item:hover { color: #c8d0e0; background: rgba(59,130,246,0.06); }
.mm-item.mm-active { color: #5c9cff; background: rgba(59,130,246,0.1); font-weight: 600; }

/* 中央 3D */
.mm-viewer {
    flex: 1; position: relative; overflow: hidden; min-width: 300px; min-height: 400px;
    background: radial-gradient(ellipse at 50% 40%, rgba(15, 25, 50, 0.6), rgba(5, 5, 15, 0.8));
}
.mm-viewer-inner { position: absolute; inset: 0; }
.mm-viewer-inner canvas { width: 100% !important; height: 100% !important; display: block; }
.mm-viewer-hint {
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
    color: rgba(100, 116, 139, 0.3); font-size: 11px; pointer-events: none;
    background: rgba(0,0,0,0.2); padding: 3px 14px; border-radius: 999px; white-space: nowrap;
    z-index: 5;
}

/* 右侧知识面板 */
.mm-info {
    width: 280px; flex-shrink: 0; overflow-y: auto;
    background: rgba(10, 14, 26, 0.25);
    border-left: 1px solid rgba(42, 58, 92, 0.1);
    padding: 18px 18px;
}
.mm-info-title {
    font-size: 17px; font-weight: 700; color: #e2e8f0;
    margin-bottom: 16px; letter-spacing: 0.3px; line-height: 1.35;
}

/* 知识面板内容 */
.kp-section { margin-bottom: 16px; }
.kp-section-title {
    font-size: 10px; font-weight: 700; color: #4a7ab8;
    text-transform: uppercase; letter-spacing: 1.5px;
    margin-bottom: 6px; padding-bottom: 3px;
    border-bottom: 1px solid rgba(42, 58, 92, 0.1);
}
.kp-formula-title { color: #c09820; }
.kp-content { color: #7a8aa5; font-size: 13px; line-height: 1.75; padding: 2px 0; }
.kp-list { display: flex; flex-direction: column; gap: 3px; padding: 2px 0; }
.kp-item {
    color: #7a8aa5; font-size: 12px; padding: 4px 10px;
    background: rgba(59, 130, 246, 0.03);
    border-left: 2px solid rgba(59, 130, 246, 0.18);
    border-radius: 0 3px 3px 0; line-height: 1.4;
}
.kp-formula {
    background: rgba(10, 14, 26, 0.35);
    border: 1px solid rgba(42, 58, 92, 0.18);
    border-radius: 5px; padding: 10px 12px;
    font-family: 'Times New Roman', serif;
    font-size: 13px; color: #c09820; line-height: 1.6; text-align: center;
}

/* 信息面板切换按钮（窄屏用） */
.mm-info-toggle {
    position: fixed; right: 12px; top: 64px; z-index: 26;
    display: none; width: 36px; height: 36px;
    align-items: center; justify-content: center;
    font-size: 18px; background: rgba(10, 14, 26, 0.6);
    border: 1px solid rgba(42, 58, 92, 0.3);
    border-radius: 8px; cursor: pointer;
    backdrop-filter: blur(6px); transition: all 0.2s;
}
.mm-info-toggle:hover { background: rgba(30, 41, 59, 0.8); border-color: rgba(59,130,246,0.3); }

/* 观察模式按钮 */
.mode-selector {
    position: absolute; bottom: 54px; left: 50%; transform: translateX(-50%);
    z-index: 20; display: flex; gap: 4px;
    background: rgba(10, 14, 26, 0.55);
    border: 1px solid rgba(42, 58, 92, 0.2);
    border-radius: 999px; padding: 4px 8px;
}
.mode-btn {
    padding: 4px 14px; font-size: 11px; font-weight: 500;
    color: #8892a0; background: transparent;
    border: 1px solid transparent; border-radius: 999px;
    cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.mode-btn:hover { color: #d0d8e4; background: rgba(59,130,246,0.06); }
.mode-btn.mode-active { color: #60a5fa; background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.2); }

/* 加载状态 */
.mm-loading {
    position: absolute; inset: 0; z-index: 10;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; background: rgba(8, 12, 24, 0.6);
}
.mm-loading-spinner {
    width: 28px; height: 28px;
    border: 2px solid rgba(59, 130, 246, 0.12);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: mmSpin 0.7s linear infinite;
}
@keyframes mmSpin { to { transform: rotate(360deg); } }
.mm-loading-text { color: #5a6a80; font-size: 12px; letter-spacing: 1px; }

/* ============================================================
   响应式断点
   ============================================================ */

/* 1440-1599: 缩小左右栏 */
@media (max-width: 1599px) {
    .mm-sidebar { width: 180px; }
    .mm-info { width: 240px; padding: 14px 14px; }
    .mm-info-title { font-size: 15px; }
    .mm-item { font-size: 11px; padding: 5px 12px 5px 20px; }
    .mm-cat-header { font-size: 12px; padding: 7px 16px; }
}

/* 1200-1439: 更窄的左右栏，缩小字号 */
@media (max-width: 1439px) {
    .mm-sidebar { width: 150px; }
    .mm-info { width: 200px; padding: 12px 12px; }
    .mm-info-title { font-size: 14px; margin-bottom: 12px; }
    .mm-item { font-size: 11px; padding: 4px 10px 4px 16px; }
    .mm-cat-header { font-size: 11px; padding: 6px 12px; }
    .mm-title { font-size: 11px; padding: 0 12px 10px; }
    .mm-cat-list { padding: 0 4px 6px; }
    .kp-content { font-size: 12px; }
    .kp-item { font-size: 11px; padding: 3px 8px; }
    .kp-formula { font-size: 12px; padding: 8px 10px; }
}

/* 1024-1199: 折叠右侧知识面板 + 显示切换按钮 */
@media (max-width: 1199px) {
    .mm-sidebar { width: 140px; }
    .mm-info-toggle { display: flex; }
    .mm-info {
        position: fixed; right: 0; top: 52px; bottom: 0; width: 280px;
        transform: translateX(100%); transition: transform 0.3s ease; z-index: 25;
        border-left: 1px solid rgba(42, 58, 92, 0.2);
    }
    .mm-info.open { transform: translateX(0); }
}

/* 768-1023: 折叠右侧面板 + 缩小导航 */
@media (max-width: 1023px) {
    .mm-sidebar { width: 120px; }
    .mm-item { font-size: 10px; padding: 4px 8px 4px 12px; }
    .mm-cat-header { font-size: 10px; padding: 5px 10px; }
    .mm-title { font-size: 10px; padding: 0 10px 8px; }
}

/* < 768: 纵向堆叠 */
@media (max-width: 767px) {
    #mindmap { flex-direction: column; }
    .mm-sidebar { width: 100%; max-height: 35%; overflow-y: auto; }
    .mm-viewer { min-height: 40%; }
    .mm-info {
        width: 100%; max-height: 30%; position: relative; top: auto;
        transform: none; border-left: none; border-top: 1px solid rgba(42, 58, 92, 0.12);
    }
}
