/* ==========================================================================
   BOSHIRUI / DIAIDI 全站通用【暗黑流光 + 苹果银灰 双主题二合一】完整版
   已内置 #three-container、.glass-panel 固定定位与 .panel-hidden 抽屉动画
   ========================================================================== */

/* -------------------- 0. 核心画布与抽屉定位底座 (必不可少) -------------------- */
body, html {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    background-color: #070b14 !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif !important;
    -webkit-font-smoothing: antialiased;
    touch-action: none;
}

#three-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1 !important;
    background-color: #0f172a;
}
#three-container canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

/* -------------------- A. 默认主题：🌙 工业深空暗黑流光 -------------------- */
.glass-panel, #sidePanel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 344px !important;
    height: 100vh !important;
    z-index: 100 !important;
    pointer-events: auto !important;
    color: #e2e8f0 !important;
    background: linear-gradient(180deg, rgba(11, 17, 30, 0.96) 0%, rgba(7, 11, 20, 0.99) 100%) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-right: 1px solid rgba(56, 189, 248, 0.25) !important;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.78), inset -1px 0 0 rgba(255, 255, 255, 0.06) !important;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease !important;
}

/* 抽屉收起状态（保留右侧耳标在屏幕左边缘可见） */
.panel-hidden {
    transform: translateX(-100%) !important;
}

.glass-panel ::-webkit-scrollbar { width: 4px !important; }
.glass-panel ::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.4) !important; }
.glass-panel ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #0284c7, #38bdf8) !important; border-radius: 999px !important; }

/* 侧翼外挂悬浮耳标按钮 (展开面板 / EN / AR / ☀️浅色) */
.toggle-btn, .lang-btn, .ar-btn, .theme-btn {
    position: absolute !important;
    right: -42px !important;
    width: 42px !important;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.97) 0%, rgba(9, 14, 26, 0.99) 100%) !important;
    border: 1px solid rgba(56, 189, 248, 0.32) !important;
    border-left: none !important;
    border-radius: 0 10px 10px 0 !important;
    box-shadow: 6px 4px 18px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 101 !important;
    user-select: none !important;
    transition: all 0.22s ease !important;
}
.toggle-btn {
    top: 50% !important;
    transform: translateY(-50%) !important;
    height: 118px !important;
    gap: 8px !important;
}
.lang-btn {
    top: calc(50% + 90px) !important;
    transform: translateY(-50%) !important;
    height: 48px !important;
    font-weight: 800 !important;
    color: #38bdf8 !important;
    font-size: 13px !important;
}
.ar-btn {
    top: calc(50% + 148px) !important;
    transform: translateY(-50%) !important;
    height: 50px !important;
    font-weight: 800 !important;
    color: #34d399 !important;
    font-size: 13px !important;
    border-color: rgba(52, 211, 153, 0.35) !important;
}
.theme-btn {
    top: calc(50% + 208px) !important;
    transform: translateY(-50%) !important;
    height: 50px !important;
    font-weight: 800 !important;
    color: #fbbf24 !important;
    font-size: 13px !important;
    border-color: rgba(251, 191, 36, 0.35) !important;
}
.toggle-btn:hover, .lang-btn:hover { border-color: #38bdf8 !important; box-shadow: 0 0 18px rgba(56, 189, 248, 0.4) !important; color: #ffffff !important; }
.ar-btn:hover { border-color: #34d399 !important; box-shadow: 0 0 18px rgba(52, 211, 153, 0.4) !important; }
.theme-btn:hover { border-color: #fbbf24 !important; box-shadow: 0 0 18px rgba(251, 191, 36, 0.4) !important; }
.btn-label-text { writing-mode: vertical-rl !important; text-orientation: mixed !important; font-size: 11px !important; letter-spacing: 2px !important; color: #cbd5e1 !important; text-shadow: none !important; }
.arrow-icon { transition: transform 0.3s ease !important; color: #38bdf8 !important; }

/* 卡片与内凹参数槽 */
#sidePanel .bg-white\/\[0\.03\], .glass-panel .bg-white\/\[0\.03\] {
    background: linear-gradient(180deg, rgba(22, 32, 52, 0.65) 0%, rgba(13, 20, 36, 0.82) 100%) !important;
    border: 1px solid rgba(148, 163, 184, 0.16) !important;
    border-top-color: rgba(255, 255, 255, 0.14) !important;
    border-radius: 11px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
#sidePanel .bg-black\/30, .glass-panel .bg-black\/30 {
    background: rgba(6, 10, 19, 0.78) !important;
    border: 1px solid rgba(100, 116, 139, 0.20) !important;
    border-radius: 8px !important;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7) !important;
}

/* 标题左侧能量竖条 */
.label-mini { font-size: 11px; color: #64748b; margin-bottom: 4px; display: block; }
#sidePanel .label-mini.text-cyan-400,
#sidePanel .label-mini.text-cyan-500,
#sidePanel .label-mini.text-emerald-400,
.glass-panel .label-mini.text-cyan-400 {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}
#sidePanel .label-mini.text-cyan-400::before,
#sidePanel .label-mini.text-cyan-500::before,
#sidePanel .label-mini.text-emerald-400::before,
.glass-panel .label-mini.text-cyan-400::before {
    content: ""; display: inline-block; width: 3px; height: 11px; border-radius: 2px;
    background: currentColor; box-shadow: 0 0 8px currentColor; flex-shrink: 0;
}

/* 步进键帽 (+ / -) */
#sidePanel .stepper-btn, .glass-panel .stepper-btn, .stepper-btn {
    background: linear-gradient(180deg, #26354d 0%, #162033 100%) !important;
    color: #f8fafc !important;
    width: 40px; height: 40px;
    display: flex !important; align-items: center !important; justify-content: center !important;
    border-radius: 6px !important;
    border: 1px solid rgba(148, 163, 184, 0.30) !important;
    border-top-color: rgba(255, 255, 255, 0.24) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    font-weight: 700 !important;
    cursor: pointer !important; user-select: none !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
#sidePanel .stepper-btn:hover, .glass-panel .stepper-btn:hover, .stepper-btn:hover {
    background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important;
    border-color: #7dd3fc !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
    transform: translateY(-1px) !important;
}
#sidePanel .stepper-btn:active, .glass-panel .stepper-btn:active, .stepper-btn:active {
    background: #0ea5e9 !important;
    transform: scale(0.90) !important;
}

/* 下拉框与输入框 */
select, .input-field-bsr {
    color-scheme: dark !important;
    background: linear-gradient(180deg, #090e1a 0%, #0d1526 100%) !important;
    border: 1px solid rgba(100, 116, 139, 0.38) !important;
    border-radius: 7px !important;
    padding: 7px 10px;
    font-size: 13px;
    color: #f8fafc !important;
    width: 100%;
    outline: 0;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.65), 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    transition: all 0.2s ease !important;
}
select:hover, .input-field-bsr:hover:not([readonly]) {
    border-color: rgba(56, 189, 248, 0.7) !important;
}
select option, .input-field-bsr option, select optgroup {
    background-color: #0f172a !important; color: #f8fafc !important;
}
#sidePanel input.input-field-bsr.border-none,
#sidePanel input.input-field-bsr[readonly].bg-transparent,
.glass-panel input.input-field-bsr.border-none {
    background: transparent !important; border: none !important; box-shadow: none !important;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4) !important;
}

/* 切换开关与滑块（强制横向并排，防止变成上下两行） */
.toggle-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    background: #060a12 !important;
    border-radius: 8px !important;
    padding: 3px !important;
    border: 1px solid rgba(100, 116, 139, 0.24) !important;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.75) !important;
}
.toggle-item {
    flex: 1 !important;
    text-align: center !important;
    padding: 5px 8px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    color: #94a3b8 !important;
}
.toggle-active {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.5) !important;
}
.lift-btn {
    padding: 6px 10px; font-size: 11px; border-radius: 6px !important; font-weight: 600 !important;
    cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex; justify-content: center; align-items: center; flex: 1;
}
.auto-active {
    background: rgba(132, 204, 22, 0.3) !important; border-color: #84cc16 !important;
    box-shadow: 0 0 10px rgba(132, 204, 22, 0.4) !important; color: #fff !important;
}

.zoom-slider {
    -webkit-appearance: none; width: 100%; height: 5px !important;
    background: linear-gradient(90deg, #0369a1 0%, #38bdf8 100%) !important;
    border-radius: 999px !important; outline: 0;
}
.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px !important; height: 16px !important; background: #f8fafc !important;
    cursor: pointer; border-radius: 50%;
    border: 3px solid #0284c7 !important; box-shadow: 0 0 10px rgba(56, 189, 248, 0.85) !important;
}
.switch { position: relative; display: inline-block; width: 34px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #334155; transition: .4s; border-radius: 18px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background: linear-gradient(90deg, #0284c7, #06b6d4) !important; }
input:checked + .slider:before { transform: translateX(16px); }

#global-readouts .bg-white\/5 {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.90) 0%, rgba(9, 14, 26, 0.96) 100%) !important;
    border-radius: 9px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}
.data-value { font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas, monospace; font-weight: 700; }
.cad-input { background: transparent; border: none; border-bottom: 1px dashed rgba(6, 182, 212, 0.5); color: #22d3ee; font-weight: bold; width: 140px; text-align: center; outline: none; padding: 2px 5px; }
.hidden { display: none !important; }
.error-border { border-color: #ef4444 !important; box-shadow: 0 0 8px rgba(239, 68, 68, 0.5) !important; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none !important; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }


/* -------------------- B. 切换主题：☀️ 苹果银灰磨砂风 (body.bsr-theme-light) -------------------- */
body.bsr-theme-light .glass-panel,
body.bsr-theme-light #sidePanel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(241, 245, 249, 0.96) 100%) !important;
    border-right: 1px solid rgba(203, 213, 225, 0.9) !important;
    box-shadow: 12px 0 36px rgba(15, 23, 42, 0.15), inset -1px 0 0 #ffffff !important;
    color: #0f172a !important;
}
body.bsr-theme-light .glass-panel ::-webkit-scrollbar-track { background: rgba(226, 232, 240, 0.6) !important; }
body.bsr-theme-light .glass-panel ::-webkit-scrollbar-thumb { background: #94a3b8 !important; }

body.bsr-theme-light #sidePanel h1,
body.bsr-theme-light #sidePanel .text-white,
body.bsr-theme-light .glass-panel .text-white { color: #0f172a !important; }
body.bsr-theme-light #sidePanel .text-gray-300,
body.bsr-theme-light #sidePanel .text-gray-400,
body.bsr-theme-light .glass-panel .text-gray-400 { color: #475569 !important; }
body.bsr-theme-light #sidePanel .text-gray-500 { color: #64748b !important; }
body.bsr-theme-light #sidePanel .text-cyan-300,
body.bsr-theme-light #sidePanel .text-cyan-400,
body.bsr-theme-light #sidePanel .text-sky-400 { color: #0284c7 !important; }
body.bsr-theme-light #sidePanel .text-emerald-300,
body.bsr-theme-light #sidePanel .text-emerald-400,
body.bsr-theme-light #sidePanel .text-green-400 { color: #059669 !important; }
body.bsr-theme-light #sidePanel .text-purple-300,
body.bsr-theme-light #sidePanel .text-purple-400 { color: #7c3aed !important; }
body.bsr-theme-light #sidePanel .text-orange-400,
body.bsr-theme-light #sidePanel .text-amber-400\/80 { color: #d97706 !important; }
body.bsr-theme-light #sidePanel .border-white\/10,
body.bsr-theme-light #sidePanel .border-b { border-color: rgba(148, 163, 184, 0.28) !important; }

body.bsr-theme-light #sidePanel #hudHomeLink {
    background: #ffffff !important; color: #0284c7 !important; border: 1px solid #cbd5e1 !important;
}

body.bsr-theme-light .toggle-btn,
body.bsr-theme-light .lang-btn,
body.bsr-theme-light .ar-btn,
body.bsr-theme-light .theme-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 249, 0.98) 100%) !important;
    border-color: #cbd5e1 !important;
    box-shadow: 6px 4px 16px rgba(15, 23, 42, 0.14), inset 0 1px 0 #ffffff !important;
}
body.bsr-theme-light .btn-label-text { color: #334155 !important; font-weight: 700 !important; }
body.bsr-theme-light .arrow-icon, body.bsr-theme-light .lang-btn { color: #0284c7 !important; filter: none !important; }
body.bsr-theme-light .ar-btn { color: #059669 !important; }
body.bsr-theme-light .theme-btn { color: #d97706 !important; }

body.bsr-theme-light #sidePanel .bg-white\/\[0\.03\],
body.bsr-theme-light .glass-panel .bg-white\/\[0\.03\] {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(203, 213, 225, 0.85) !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04), inset 0 1px 0 #ffffff !important;
}
body.bsr-theme-light #sidePanel .bg-black\/30,
body.bsr-theme-light .glass-panel .bg-black\/30 {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.06) !important;
}
body.bsr-theme-light #sidePanel .label-mini::before { box-shadow: none !important; }

body.bsr-theme-light #sidePanel .stepper-btn,
body.bsr-theme-light .glass-panel .stepper-btn,
body.bsr-theme-light .stepper-btn {
    background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%) !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-top-color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12), inset 0 1px 0 #ffffff !important;
}
body.bsr-theme-light #sidePanel .stepper-btn:hover,
body.bsr-theme-light .stepper-btn:hover {
    background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important;
    border-color: #0284c7 !important; color: #ffffff !important;
}

body.bsr-theme-light select,
body.bsr-theme-light .input-field-bsr {
    color-scheme: light !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
}
body.bsr-theme-light select option,
body.bsr-theme-light .input-field-bsr option,
body.bsr-theme-light select optgroup {
    background-color: #ffffff !important; color: #0f172a !important;
}
body.bsr-theme-light #sidePanel input.input-field-bsr.border-none,
body.bsr-theme-light #sidePanel input.input-field-bsr[readonly].bg-transparent {
    background: transparent !important; border: none !important; box-shadow: none !important;
    color: #0284c7 !important; font-weight: 800 !important; text-shadow: none !important;
}

body.bsr-theme-light .toggle-group {
    background: #e2e8f0 !important; border: 1px solid #cbd5e1 !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08) !important;
}
body.bsr-theme-light .toggle-item { color: #475569 !important; }
body.bsr-theme-light .toggle-active {
    background: #ffffff !important; color: #0284c7 !important; font-weight: 800 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.14) !important;
}
body.bsr-theme-light .lift-btn {
    background: #ffffff !important; color: #334155 !important; border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
}
body.bsr-theme-light .slider { background-color: #cbd5e1 !important; box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.15) !important; }
body.bsr-theme-light #sidePanel button[onclick*="img-upload"] { background: #e0f2fe !important; border-color: #7dd3fc !important; color: #0369a1 !important; }
body.bsr-theme-light #sidePanel button[onclick*="video-upload"] { background: #f3e8ff !important; border-color: #d8b4fe !important; color: #6d28d9 !important; }
body.bsr-theme-light #sidePanel button[onclick*="openCADModal"] { background: linear-gradient(135deg, #0284c7, #0369a1) !important; color: #ffffff !important; }
body.bsr-theme-light #sidePanel #btn-export-4k { background: linear-gradient(135deg, #0d9488, #0f766e) !important; color: #ffffff !important; }
body.bsr-theme-light #sidePanel #btn-quotation { background: linear-gradient(135deg, #059669, #047857) !important; color: #ffffff !important; }
body.bsr-theme-light #global-readouts .bg-white\/5 {
    background: #ffffff !important; border: 1px solid #cbd5e1 !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
}
body.bsr-theme-light #psu-count { background: #fef3c7 !important; color: #b45309 !important; }
body.bsr-theme-light #sub-global-readouts { background: #ecfdf5 !important; border-color: #6ee7b7 !important; }