
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: #0b0f16; color: #c8d4e4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
  }
  button { font-family: inherit; cursor: pointer; }
  .btn {
    font-size: 12.5px; padding: 8px 14px; border-radius: 8px;
    border: 1px solid rgba(120,160,220,.22);
    background: rgba(40, 54, 78, .8); color: #b6c6db;
    transition: all .15s;
  }
  .btn:hover { background: rgba(58, 82, 120, .95); color: #eaf2ff; }
  .btn.active {
    background: rgba(45, 110, 220, .9); color: #fff;
    border-color: rgba(91,157,255,.8);
  }
  input[type="text"] {
    width: 100%; font-family: inherit; font-size: 16px;
    padding: 9px 10px; border-radius: 8px;
    background: rgba(12, 17, 26, .8); color: #d8e4f2;
    border: 1px solid rgba(120,160,220,.18);
    outline: none;
  }
  input:focus { border-color: rgba(91,157,255,.65); }
  input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 30px; background: transparent;
    outline: none; margin: 0 0 8px;
    touch-action: none; padding: 12px 0;
  }
  input[type="range"]::-webkit-slider-runnable-track {
    height: 4px; border-radius: 2px; background: #2a3448;
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 20px; height: 20px;
    border-radius: 50%; margin-top: -8px;
    background: #5b9dff; cursor: pointer;
    box-shadow: 0 0 0 3px rgba(91,157,255,.18);
    touch-action: none;
  }
  input[type="range"]::-moz-range-thumb {
    width: 20px; height: 20px; border: none; border-radius: 50%;
    background: #5b9dff; cursor: pointer;
  }
  .view { display: none; width: 100%; height: 100%; }
  .view.active { display: block; }
  .mobile-only { display: none; }
  #mobile-mask { display: none; }

  /* ---------- 模型库 ---------- */
  .topbar {
    height: 60px; padding: 0 24px;
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid rgba(120,160,220,.10);
    background: rgba(14, 19, 28, .82);
    backdrop-filter: blur(12px);
    position: relative; z-index: 5;
  }
  .topbar::after {
    content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(91,157,255,.35) 30%, rgba(91,157,255,.35) 70%, transparent);
  }
  .brand-mini { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .brand-mini .ico {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, #3d7ee6, #5b9dff);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(45,110,220,.4);
  }
  .brand-mini .ico svg { width: 17px; height: 17px; }
  .brand-mini .txt {
    font-size: 14px; font-weight: 600; color: #e8f0fb; letter-spacing: .6px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar .spacer { flex: 1; }
  .topbar .tag {
    font-size: 11.5px; color: #7fb6ff;
    padding: 4px 12px; border-radius: 8px;
    background: rgba(91,157,255,.10);
    border: 1px solid rgba(91,157,255,.20);
    flex-shrink: 0;
  }
  #list-body {
    padding: 28px 24px;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overflow-y: auto;
  }
  #list-body::-webkit-scrollbar { width: 8px; }
  #list-body::-webkit-scrollbar-thumb { background: rgba(120,160,220,0.25); border-radius: 4px; }
  .page-title { margin-bottom: 22px; }
  .page-title h2 { font-size: 19px; color: #eef5ff; font-weight: 600; letter-spacing: .5px; }
  .page-title .desc { font-size: 12.5px; color: #6b7d94; margin-top: 6px; }
  #search-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
  #search-input {
    width: 300px; padding-left: 34px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7d94' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
    background-repeat: no-repeat;
    background-position: 11px center;
  }
  #model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
  }
  .mcard {
    border-radius: 16px; overflow: hidden;
    background: rgba(20, 27, 39, .8);
    border: 1px solid rgba(120,160,220,.13);
    transition: transform .18s, border-color .18s, box-shadow .18s;
    display: flex; flex-direction: column; cursor: pointer;
    position: relative;
  }
  @media (hover: hover) {
    .mcard:hover {
      transform: translateY(-3px);
      border-color: rgba(91,157,255,.35);
      box-shadow: 0 16px 40px rgba(0,0,0,.55), 0 0 20px rgba(45,110,220,.15);
    }
  }
  .mcard .cover {
    height: 140px;
    background:
      radial-gradient(circle at 50% 40%, rgba(91,157,255,.16), transparent 65%),
      linear-gradient(135deg, #1a2432, #121821);
    display: flex; align-items: center; justify-content: center;
    color: #46586f; font-size: 12px; overflow: hidden;
  }
  .mcard .cover img { width: 100%; height: 100%; object-fit: cover; }
  .mcard .cover .ph {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    color: #4d6080;
  }
  .mcard .cover .ph svg { width: 34px; height: 34px; opacity: .75; }
  .mcard .cover .ph span { font-size: 11px; letter-spacing: .5px; }
  .mcard .info { padding: 14px 16px 16px; }
  .mcard .info h3 {
    font-size: 14px; color: #e6eefb; margin-bottom: 6px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mcard .info .meta { font-size: 11.5px; color: #6b7d94; line-height: 1.7; }
  .mcard .info .meta .cat {
    display: inline-block; font-size: 10.5px; padding: 1px 8px; border-radius: 8px;
    background: rgba(91,157,255,.12); color: #7fb6ff; margin-bottom: 4px;
  }
  .empty-tip {
    text-align: center; color: #5a6a80; padding: 80px 20px; font-size: 13px;
  }
  .empty-tip svg { width: 56px; height: 56px; opacity: .4; margin-bottom: 16px; }

  /* ---------- 观察器 ---------- */
  #viewer-view.active {
    display: grid; grid-template-rows: 60px 1fr;
    grid-template-areas: "topbar" "viewport";
    height: 100vh; height: 100dvh;
  }
  #v-topbar {
    grid-area: topbar;
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    padding-top: env(safe-area-inset-top, 0);
    border-bottom: 1px solid rgba(120,160,220,.10);
    background: rgba(14, 19, 28, .88);
    backdrop-filter: blur(12px);
    z-index: 20; position: relative;
  }
  #v-topbar .divider {
    width: 1px; height: 20px; background: rgba(120,160,220,.2); margin: 0 6px;
  }
  #v-topbar .title {
    font-size: 13.5px; color: #eaf2ff; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #v-topbar .spacer { flex: 1; }
  #viewport {
    grid-area: viewport; position: relative; overflow: hidden;
    background: #0b0f16; touch-action: none;
  }
  #viewport canvas { display: block; }
  .panel {
    position: absolute; border-radius: 14px;
    background: rgba(18, 24, 34, 0.9);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(120, 160, 220, 0.14);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    z-index: 10; user-select: none;
  }
  #panel {
    top: 18px; left: 18px; width: 254px;
    max-height: calc(100% - 36px); overflow-y: auto;
    padding: 14px; overscroll-behavior: contain;
  }
  .section { margin-bottom: 14px; }
  .section:last-child { margin-bottom: 0; }
  .label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: #8fa3bd; margin-bottom: 6px;
  }
  .value { color: #5b9dff; font-variant-numeric: tabular-nums; }
  .btns { display: flex; gap: 8px; }
  .btns + .btns { margin-top: 8px; }
  #panel button {
    font-size: 12px; padding: 8px 10px; border-radius: 8px; flex: 1;
    border: 1px solid rgba(120,160,220,.18);
    background: rgba(40, 54, 78, .7); color: #a9bcd4;
    transition: all .15s;
  }
  #panel button:hover { background: rgba(58, 82, 120, .9); color: #e0ebf8; }
  #panel button.active {
    background: rgba(45, 110, 220, .9); color: #fff;
    border-color: rgba(91,157,255,.8);
  }
  .check {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0; color: #9fb2ca; cursor: pointer; font-size: 12.5px;
  }
  .check input { accent-color: #5b9dff; cursor: pointer; width: 18px; height: 18px; }
  ._bgswatch-disabled { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  ._bgswatch-disabled button {
    height: 40px; border-radius: 8px; padding: 0;
    border: 2px solid rgba(255,255,255,0.14);
    cursor: pointer; position: relative;
  }
  ._bgswatch-disabled button.active {
    border-color: #5b9dff;
    box-shadow: 0 0 10px rgba(91,157,255,.55);
  }
  ._bgswatch-disabled button span {
    position: absolute; bottom: 3px; left: 0; right: 0;
    font-size: 10px; text-align: center; color: #8fa3bd;
    text-shadow: 0 1px 2px rgba(0,0,0,.4); pointer-events: none;
  }
  ._bgswatch-disabled button[data-bg="#f0f2f5"] span { color: #5f6b7a; text-shadow: none; }
  #view-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  #view-grid button { padding: 8px 4px; font-size: 11.5px; }
  #parts-panel {
    top: 18px; right: 18px; width: 262px;
    max-height: calc(100% - 36px);
    display: flex; flex-direction: column; overflow: hidden;
  }
  #parts-panel .pp-head {
    padding: 12px 16px 10px;
    border-bottom: 1px solid rgba(120,160,220,0.10);
    display: flex; justify-content: space-between; align-items: center;
  }
  #parts-panel .pp-head h2 { font-size: 13px; font-weight: 600; color: #dfe9f6; }
  #parts-panel .pp-count {
    font-size: 11px; color: #5b9dff;
    background: rgba(91,157,255,.12); padding: 2px 8px; border-radius: 10px;
  }
  #parts-list {
    flex: 1; overflow-y: auto; padding: 8px;
    min-height: 80px; max-height: 34vh; overscroll-behavior: contain;
  }
  .part-item {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 10px; border-radius: 8px; cursor: pointer;
    color: #9fb2ca; font-size: 12.5px; transition: background .12s, color .12s;
  }
  .part-item:hover { background: rgba(70, 110, 170, .18); color: #d5e2f2; }
  .part-item.active {
    background: rgba(45, 110, 220, .28); color: #eaf2ff;
    box-shadow: inset 0 0 0 1px rgba(91,157,255,.45);
  }
  .pi-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #3a4a63; flex-shrink: 0;
  }
  .part-item.active .pi-dot { background: #5b9dff; box-shadow: 0 0 8px rgba(91,157,255,.9); }
  .pi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #part-detail {
    border-top: 1px solid rgba(120,160,220,0.12);
    padding: 14px 16px 16px;
    background: rgba(12, 17, 26, .5);
    max-height: 46%; overflow-y: auto; overscroll-behavior: contain;
  }
  .pd-name { font-size: 13.5px; font-weight: 600; color: #eaf2ff; margin-bottom: 8px; }
  .pd-name.empty { color: #6b7d94; font-weight: 400; }
  .pd-desc {
    font-size: 12.5px; line-height: 1.65; color: #9fb2ca;
    white-space: pre-wrap;
  }
  .pd-desc.empty { color: #5a6a80; font-style: italic; }
  .pd-actions { margin-top: 12px; display: flex; gap: 8px; }
  .pd-actions button {
    flex: 1; font-size: 12px; padding: 9px 10px; border-radius: 8px;
    border: 1px solid rgba(120,160,220,.18);
    background: rgba(40, 54, 78, .7); color: #a9bcd4;
  }
  .pd-actions button.active {
    background: rgba(45, 110, 220, .9); color: #fff;
    border-color: rgba(91,157,255,.8);
  }
  #hint {
    position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
    font-size: 11.5px; color: #7f93ad;
    background: rgba(11,15,22,.62); padding: 6px 14px; border-radius: 20px;
    backdrop-filter: blur(6px); pointer-events: none; white-space: nowrap; z-index: 5;
  }
  #v-loading {
    position: absolute; inset: 0; display: none;
    align-items: center; justify-content: center;
    background: rgba(11,15,22,.82); color: #5b9dff;
    font-size: 13px; letter-spacing: 1px; z-index: 50;
  }
  #v-loading.show { display: flex; }
  #toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px; border-radius: 10px;
    background: rgba(30, 40, 56, .95); color: #d8e4f2;
    font-size: 12.5px; opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s; z-index: 200;
    border: 1px solid rgba(120,160,220,.2); max-width: 80vw;
  }
  #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  #toast.err { color: #ffb0b0; border-color: rgba(220,90,90,.4); }

  /* ==================== 平板 ==================== */
  @media (max-width: 1024px) {
    #panel { width: 224px; padding: 12px; }
    #parts-panel { width: 236px; }
    #model-grid {
      grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
      gap: 14px;
    }
  }

  /* ==================== 手机 / 窄屏（含横屏） ==================== */
  @media (max-width: 900px) {
    .mobile-only { display: inline-flex; align-items: center; justify-content: center; }
    #v-topbar { height: 54px; padding: 0 10px; gap: 8px; }
    #v-topbar .brand-mini { gap: 6px; }
    #v-topbar .brand-mini .txt { display: none; }
    #v-topbar .brand-mini .ico { width: 26px; height: 26px; border-radius: 7px; }
    #v-topbar .brand-mini .ico svg { width: 14px; height: 14px; }
    #v-topbar .divider { display: none; }
    #v-topbar .brand-mini { display: none; }
    #v-topbar .title { font-size: 12.5px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #v-topbar .btn { padding: 6px 9px; font-size: 11.5px; }
    #btn-toggle-ui { display: none; }
    #v-topbar { padding-left: 62px; }
    #list-view .topbar { padding-left: 62px; }
    #ai-icon {
      left: 10px; top: 8px; right: auto; bottom: auto;
      width: 44px; height: 44px; padding: 5px;
    }
    #viewer-view.active { grid-template-rows: 54px 1fr; height: 100vh; height: 100dvh; }
    .topbar { padding: 0 14px; gap: 10px; height: 54px; }
    .topbar .brand-mini .txt { font-size: 12.5px; }
    .topbar .tag { display: none; }
    #list-body {
      padding: 18px 14px;
      height: calc(100vh - 54px); height: calc(100dvh - 54px);
    }
    .page-title h2 { font-size: 16px; }
    .page-title .desc { font-size: 12px; }
    #search-bar { margin-bottom: 16px; }
    #search-input { width: 100%; font-size: 16px; }
    #model-grid { grid-template-columns: 1fr; gap: 12px; }
    .mcard .cover { height: 130px; }
    #panel, #parts-panel {
      position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: 100%;
      max-height: 62vh; border-radius: 18px 18px 0 0;
      border-left: none; border-right: none; border-bottom: none;
      transform: translateY(105%);
      transition: transform .3s cubic-bezier(.2,.8,.3,1);
      z-index: 30;
      padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
      padding-top: 22px; overscroll-behavior: contain;
    }
    #panel.open, #parts-panel.open { transform: translateY(0); }
    #panel::before, #parts-panel::before {
      content: ''; position: absolute; top: 8px; left: 50%;
      transform: translateX(-50%); width: 40px; height: 4px;
      background: rgba(120,160,220,.32); border-radius: 2px;
    }
    #parts-panel .pp-head { padding-top: 8px; }
    #parts-list { max-height: 22vh; min-height: 60px; }
    #part-detail { max-height: 26vh; }
    #mobile-mask.show {
      display: block; position: fixed; inset: 0;
      background: rgba(0,0,0,.55); z-index: 25;
    }
    #hint { display: none; }
    #panel button { padding: 10px 10px; font-size: 12.5px; }
    .part-item { padding: 12px 12px; font-size: 13px; }
    .check { padding: 10px 0; }
    #btn-open-tasks { left: 10px; bottom: 10px; padding: 10px 14px; font-size: 13px; }
    #btn-open-tasks { display: none; }
    body.drawer-open #ai-icon { display: none; }
    #list-view .brand-mini { display: none; }
    #list-view #role-tag,
    #list-view #who { display: none; }
  }

  /* _portraitMask: 竖屏遮罩 */
  #_portraitMask {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(11,15,22,0.96);
    align-items: center; justify-content: center;
    flex-direction: column; gap: 24px;
    color: #eaf2ff; font-size: 16px; text-align: center;
    padding: 20px;
  }
  #_portraitMask.show { display: flex; }
  #_portraitMask .icon {
    font-size: 64px; color: #5b9dff;
    animation: rotateHint 2s ease-in-out infinite;
  }
  @keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
  }
  #_portraitMask button {
    padding: 12px 32px; font-size: 16px;
    border-radius: 10px; border: none;
    background: linear-gradient(135deg, #3d7ee6, #2b6ad4);
    color: #fff; cursor: pointer;
    box-shadow: 0 8px 24px rgba(45,110,220,.5);
  }
  #_portraitMask #_continueBtn {
    background: transparent; color: #9fb2ca;
    border: 1px solid rgba(120,160,220,.35);
    box-shadow: none; font-size: 14px; padding: 10px 24px;
  }


  /* _mobileLandscape: 手机横屏时的优化 */
  @media (orientation: landscape) and (max-height: 600px) and (min-width: 901px) {
    #panel {
      width: 210px;
      padding: 10px;
      top: 8px;
      left: 8px;
      max-height: calc(100% - 16px);
    }
    #parts-panel {
      width: 230px;
      top: 8px;
      right: 8px;
      max-height: calc(100% - 16px);
    }
    #panel .section { margin-bottom: 8px; }
    #panel button { padding: 6px 8px; font-size: 11px; }
    #view-grid button { padding: 5px 3px; font-size: 11px; }
    #parts-list { max-height: 26vh; }
    #part-detail { max-height: 36%; }
    #hint { display: none; }
    #v-topbar { height: 48px; padding: 0 10px; }
  }

  /* 隐藏所有面板 */
  body.ui-hidden #panel,
  body.ui-hidden #parts-panel { display: none !important; }

  /* ENTER VR 按钮移到右下角 */
  #VRButton {
    left: auto !important;
    right: 16px !important;
    bottom: 16px !important;
    transform: none !important;
  }

  /* 手机端微调：VR 按钮避开 AI 悬浮球；横屏列表两列 */
  @media (max-width: 900px) {
    #VRButton { display: none !important; }
  }
  @media (max-width: 520px) {
    #btn-fs-top { display: none !important; }
    #v-topbar .title { max-width: 18vw; }
  }
  @media (orientation: landscape) and (max-width: 900px) and (max-height: 500px) {
    #model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .mcard .cover { height: 110px; }
    .mcard .info { padding: 10px 12px; }
    .mcard h3 { font-size: 14px; }
  }

  /* 手机端：控制面板左半屏、零件面板右半屏，半透明抽屉 */
  @media (max-width: 900px) {
    #panel, #parts-panel {
      position: fixed;
      top: 54px; bottom: 0; max-height: none;
      width: 50vw;
      padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
      background: rgba(18, 26, 40, .82);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      z-index: 40;
      overflow-y: auto;
      overscroll-behavior: contain;
      border: 1px solid rgba(120, 160, 220, .18);
      transition: transform .28s cubic-bezier(.2, .8, .3, 1);
    }
    #panel {
      left: 0; right: auto; transform: translateX(-105%);
      border-radius: 0 16px 16px 0; border-left: none;
    }
    #parts-panel {
      right: 0; left: auto; transform: translateX(105%);
      border-radius: 16px 0 0 16px; border-right: none;
    }
    #panel.open, #parts-panel.open { transform: translateX(0); }
    #panel::before, #parts-panel::before { display: none; }
    #mobile-mask.show { background: rgba(0, 0, 0, .28); }
    #parts-list { max-height: 52%; }
    #part-detail { max-height: 34%; }
    #panel button { padding: 9px 8px; font-size: 12px; }
  }

  /* 任务红点 */
  .task-entry-btn { position: relative; }
  .task-dot {
    position: absolute; top: 3px; right: 3px; width: 8px; height: 8px;
    border-radius: 50%; background: #ff4d4f;
    box-shadow: 0 0 0 2px #0b0f16;
    display: none;
  }
  .task-dot.show { display: block; }

  /* 任务入口统一收进顶栏，隐藏左下角悬浮按钮 */
  #btn-open-tasks { display: none !important; }

  /* PC 端：左右面板等宽、对称停靠 */
  @media (min-width: 1025px) {
    #panel, #parts-panel { width: 260px; top: 18px; height: calc(100% - 36px); max-height: none; }
    #panel { left: 18px; right: auto; }
    #parts-panel { right: 18px; left: auto; }
  }
  @media (min-width: 901px) and (max-width: 1024px) {
    #panel, #parts-panel { width: 232px; height: calc(100% - 36px); max-height: none; }
  }

