:root{
  --bg:#0b1220; --panel:rgba(15,23,34,.88); --line:#2a3a4a;
  --ink:#e6edf3; --dim:#8b9bb0; --acc:#58a6ff; --ok:#3fb950; --warn:#d29922; --cat:#79c0ff;
}
*{box-sizing:border-box;margin:0;padding:0}
/* Pure CSS Zero-Latency Language Switcher */
html.lang-en .i18n-zh,
html[lang^="en"] .i18n-zh {
  display: none !important;
}
html.lang-zh .i18n-en,
html[lang^="zh"] .i18n-en {
  display: none !important;
}
html,body{height:100%;background:radial-gradient(1200px 700px at 50% 10%,#30475a 0%,#1b2b3a 62%,#111c27 100%);
  color:var(--ink);font:14px/1.6 -apple-system,BlinkMacSystemFont,"PingFang SC","Helvetica Neue",sans-serif;overflow:hidden}
#app{position:fixed;inset:0}
canvas{display:block;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.panel{position:fixed;background:var(--panel);border:1px solid var(--line);border-radius:10px;
  backdrop-filter:blur(12px);box-shadow:0 10px 30px rgba(0,0,0,.25)}

#hdr{top:16px;left:16px;padding:14px 18px;max-width:400px}
#hdr h1{font-size:16px;font-weight:650;letter-spacing:.01em;padding-right:82px}
#hdr .pn{color:var(--acc);font-size:12.5px;margin-top:3px;font-variant-numeric:tabular-nums}
#hdr .sub{color:var(--dim);font-size:12px;margin-top:8px;line-height:1.55}
.lang-btn{position:absolute;top:12px;right:12px;background:#172334;color:var(--ink);border:1px solid var(--line);
  border-radius:7px;padding:5px 8px;font-size:11px;cursor:pointer;font-family:inherit;white-space:nowrap}
.lang-btn:hover{background:#203149;border-color:#3c5670}
.lang-btn[aria-pressed=true]{background:var(--acc);border-color:var(--acc);color:#04121f;font-weight:650}

#state{top:16px;right:16px;padding:12px 16px;min-width:220px}
#state .lbl{font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--dim);margin-bottom:5px}
#state .row{display:flex;justify-content:space-between;gap:16px;padding:3px 0;font-size:12px;color:var(--dim)}
#state .row b{color:var(--ink);font-variant-numeric:tabular-nums}

#lg{bottom:94px;left:16px;padding:10px 13px;font-size:11.5px}
#lg .r{display:flex;align-items:center;gap:8px;padding:3px 0;color:var(--dim)}
#lg .sw{width:10px;height:10px;border-radius:2px;flex:0 0 10px}
#lg .hint{color:#526274;font-size:10.5px;margin-top:7px;padding-top:7px;border-top:1px solid var(--line)}

#flow{
  bottom: 84px;
  left: 16px;
  padding: 10px 14px;
  max-width: min(520px, calc(100vw - 32px));
  max-height: 260px;
  display: flex;
  flex-direction: column;
  z-index: 15;
  transition: max-height 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}
#flow.collapsed{
  max-height: 34px;
  overflow: hidden;
  padding: 6px 12px;
}
#flow.collapsed .flow-body{
  display: none;
}
.flow-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.flow-title{
  color: #79c0ff;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.flow-toggle-icon{
  font-size: 11px;
  color: var(--dim);
  transition: transform 0.2s;
}
#flow.collapsed .flow-toggle-icon{
  transform: rotate(-90deg);
}
.flow-body{
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.flow-steps{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 11.5px;
  line-height: 1.4;
}
.flow-steps .flow-tag{
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  background: rgba(88, 166, 255, 0.15);
  border: 1px solid rgba(88, 166, 255, 0.35);
  color: #79c0ff;
  white-space: nowrap;
}
.flow-tag.rotary{
  background: rgba(224, 176, 106, 0.15);
  border-color: rgba(224, 176, 106, 0.35);
  color: #e0b06a;
}
.flow-tag.mud{
  background: rgba(63, 185, 80, 0.15);
  border-color: rgba(63, 185, 80, 0.35);
  color: #56d364;
}
.flow-step-item{
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(22, 35, 52, 0.7);
  border: 1px solid rgba(56, 80, 106, 0.6);
  border-radius: 5px;
  color: #d0dce8;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.flow-step-item:hover{
  background: rgba(88, 166, 255, 0.2);
  border-color: var(--acc);
  color: #fff;
  transform: translateY(-1px);
}
.flow-arrow{
  color: #526274;
  font-size: 11px;
  padding: 0 1px;
}

#say{
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 24px;
  max-width: min(720px, calc(100vw - 40px));
  background: rgba(8, 14, 23, 0.82);
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  text-align: center;
  z-index: 10;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
#say div{
  font-size: 13.5px;
  font-weight: 550;
  color: #f0f6fc;
  letter-spacing: .02em;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
#say .en{
  font-size: 13.5px;
  font-weight: 550;
  color: #f0f6fc;
  margin-top: 0;
  font-style: normal;
  letter-spacing: .02em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* Subtitle single-language visibility */
html.lang-en #say > div:not(.en),
html.lang-en #say #sayZh,
html.lang-en #say .zh,
html[lang^="en"] #say > div:not(.en),
html[lang^="en"] #say #sayZh,
html[lang^="en"] #say .zh {
  display: none !important;
}

html.lang-zh #say .en,
html.lang-zh #say #sayEn,
html[lang^="zh"] #say .en,
html[lang^="zh"] #say #sayEn {
  display: none !important;
}

#ctl{
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: rgba(12, 19, 30, 0.92);
  border: 1px solid rgba(56, 80, 106, 0.7);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  z-index: 20;
}
#ctl::-webkit-scrollbar{display: none;}
#bRec{display: none!important;}
body.dev-mode #bRec{display: inline-block!important;}

button{
  background: #172334;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  white-space: nowrap;
}
button:hover{background: #203149; border-color: #3c5670;}
button.on{background: var(--acc); border-color: var(--acc); color: #04121f; font-weight: 650;}
button.rec{background: #3a1d1d; border-color: #6b2f2f;}
button.rec.on{background: #d24b3f; border-color: #d24b3f; color: #fff;}
.sep{width: 1px; height: 18px; background: rgba(56, 80, 106, 0.6); margin: 0 3px;}
input[type=range]{width: 88px; accent-color: var(--acc);}
.wrap{display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px;}

#labels{position:fixed;inset:0;pointer-events:none;overflow:hidden}
.lbl{position:absolute;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;
  gap:3px;white-space:nowrap;transition:opacity .15s}
.lbl .dot{width:6px;height:6px;border-radius:50%;background:var(--acc);box-shadow:0 0 0 3px rgba(88,166,255,.15)}
.lbl .tx{background:rgba(10,18,28,.82);border:1px solid var(--line);border-radius:6px;padding:4px 8px;
  font-size:11.5px;color:var(--ink);backdrop-filter:blur(6px)}
.lbl .tx small{display:block;color:var(--dim);font-size:10px;margin-top:1px}
.lbl[data-src=mixed] .dot{background:var(--warn);box-shadow:0 0 0 3px rgba(210,153,34,.15)}
.lbl[data-src=catalog] .dot{background:var(--cat);box-shadow:0 0 0 3px rgba(121,192,255,.15)}
.lbl[data-src=estimated] .dot{background:var(--warn);box-shadow:0 0 0 3px rgba(210,153,34,.15)}

#timeline{position:fixed;left:0;right:0;bottom:0;height:3px;background:rgba(255,255,255,.06);z-index:5}
#timeline > i{display:block;height:100%;width:0;background:var(--acc);transition:width .1s linear}

#credit{display:none;position:fixed;right:clamp(22px,1.7vw,33px);bottom:clamp(18px,1.4vw,27px);color:rgba(230,237,243,.62);
  font-size:clamp(16px,1.3vw,20px);letter-spacing:.06em;text-align:right;line-height:1.5}
#videoTitle{display:none;position:fixed;left:clamp(34px,2.65vw,51px);top:clamp(28px,2.2vw,42px);color:#e6edf3;font-size:clamp(27px,2.1vw,42px);font-weight:650;
  letter-spacing:.01em;line-height:1.25;text-shadow:0 2px 18px rgba(0,0,0,.6);transition:opacity .6s ease}
#videoTitleText{display:block}
#videoTitle .sub{display:block;margin-top:clamp(6px,.47vw,9px);color:#9fb3c8;font-size:clamp(13px,1.02vw,20px);font-weight:400;letter-spacing:.08em}
#videoCaption{display:none;position:fixed;left:50%;bottom:clamp(56px,4.4vw,84px);transform:translateX(-50%);
  max-width:clamp(980px,76vw,1460px);text-align:center;font-size:clamp(17px,1.33vw,26px);line-height:1.45;color:#e6edf3;white-space:pre-line;
  background:rgba(8,14,22,.62);border:1px solid rgba(90,120,150,.28);border-radius:9px;
  padding:clamp(10px,.8vw,16px) clamp(18px,1.4vw,28px);backdrop-filter:blur(8px);transition:opacity .35s ease;opacity:0}

body.video-mode #hdr, body.video-mode #state, body.video-mode #lg, body.video-mode #flow, body.video-mode #say,
body.video-mode #ctl, body.video-mode #timeline, body.video-mode #labels,
body.video-mode #panelBom, body.video-mode .asset-modal, body.video-mode .modal-backdrop,
body.video-mode #modelLoader, body.shorts-mode #modelLoader{display:none!important}
body.video-mode #videoTitle, body.video-mode #videoCaption, body.video-mode #videoUrl, body.video-mode #credit{display:block}
body.video-mode #videoTitle, body.video-mode #videoCaption, body.video-mode #videoUrl{transition:none!important}

body.shorts-mode #videoTitle{left:72px;right:96px;top:220px;font-size:44px;line-height:1.14}
body.shorts-mode #videoTitle .sub{font-size:22px;margin-top:14px;letter-spacing:.1em}
body.shorts-mode #videoTitle,body.shorts-mode #videoCaption,body.shorts-mode #videoUrl{display:none!important}
body.shorts-mode #credit{display:none}

@media(max-width:900px){#lg,#say,#flow{display:none}#hdr{max-width:320px}#state{min-width:170px;left:16px;right:auto;top:auto;bottom:160px}}

@media(max-width:900px){
  body.video-mode #videoTitle{left:24px;right:24px;top:20px;font-size:26px}
  body.video-mode #videoTitle .sub{font-size:12px;letter-spacing:.06em}
  body.video-mode #videoCaption{left:24px;right:24px;bottom:24px;max-width:none;font-size:15px;
    line-height:1.35;padding:8px 12px}
  body.video-mode #credit{right:12px;bottom:8px;font-size:12px;line-height:1.35}
}

#videoUrl{display:none;position:fixed;left:50%;bottom:clamp(150px,10.5vw,175px);transform:translateX(-50%);
  color:#dbeafe;background:rgba(8,14,22,.82);border:1px solid rgba(90,120,150,.45);border-radius:8px;
  padding:9px 15px;font-size:clamp(20px,1.5vw,26px);letter-spacing:.02em;white-space:nowrap;
  backdrop-filter:blur(8px);transition:opacity .35s ease;opacity:0}

/* Commercial & BOM panels for 3D Viewer */
#panelBom {
  position: fixed;
  top: 210px;
  right: 16px;
  left: auto !important;
  width: 270px;
  max-height: calc(100vh - 240px);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
#panelBom.collapsed .bom-body {
  display: none;
}
.bom-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: rgba(15, 23, 34, 0.95);
  border-bottom: 1px solid var(--line);
}
.bom-header .bom-title {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.bom-header .bom-toggle-icon {
  font-size: 12px;
  color: var(--dim);
  transition: transform 0.2s;
}
#panelBom.collapsed .bom-toggle-icon {
  transform: rotate(-90deg);
}
.bom-body {
  padding: 8px 12px 12px;
  overflow-y: auto;
  max-height: 380px;
}
.bom-interactive-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bom-interactive-item {
  padding: 8px 10px;
  background: rgba(22, 35, 52, 0.55);
  border: 1px solid rgba(42, 58, 74, 0.6);
  border-radius: 6px;
  font-size: 11.5px;
  color: #c6d3df;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.35;
}
.bom-interactive-item:hover, .bom-interactive-item.active {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--acc);
  color: #fff;
  transform: translateX(-2px);
}
.bom-interactive-item small {
  display: block;
  font-size: 10px;
  color: #8b9bb0;
  margin-top: 3px;
}
.btn-asset-pack {
  background: linear-gradient(180deg, #1f364d, #142435)!important;
  border-color: #388bfd!important;
  color: #e6edf3!important;
  font-weight: 600!important;
}
.btn-asset-pack:hover {
  background: linear-gradient(180deg, #274563, #1a2f45)!important;
  border-color: #58a6ff!important;
  color: #fff!important;
}
.hdr-inquiry {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--dim);
}
.hdr-inquiry a {
  color: var(--acc);
  text-decoration: none;
}
.hdr-inquiry a:hover {
  text-decoration: underline;
}

/* Modal styles for 3D viewer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 16, 0.85);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.asset-modal {
  background: #0f1826;
  border: 1px solid #3c5670;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  padding: 26px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  position: relative;
  color: #e6edf3;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--dim);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1;
}
.modal-close:hover { color: #fff; }
.asset-modal h2 { font-size: 19px; color: #fff; }
.asset-modal p.modal-sub { margin-top: 8px; font-size: 12.5px; color: #9fb3c8; line-height: 1.5; }
.modal-features { margin: 16px 0; padding: 12px 14px; background: rgba(22, 37, 54, 0.6); border-radius: 8px; border: 1px solid rgba(42, 58, 74, 0.7); }
.modal-features li { margin: 5px 0; font-size: 12px; color: #d0dce8; list-style: none; display: flex; align-items: center; gap: 8px; }
.modal-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.modal-feedback { margin-top: 10px; font-size: 11.5px; color: #3fb950; min-height: 16px; }

@media(max-width:900px){
  #panelBom {
    right: 10px;
    top: auto;
    bottom: 80px;
    width: min(280px, calc(100vw - 20px));
  }
}

/* Zero-latency CSS language visibility */
html.lang-en .i18n-zh,
html[lang^="en"] .i18n-zh {
  display: none !important;
}
html.lang-zh .i18n-en,
html[lang^="zh"] .i18n-en {
  display: none !important;
}

/* 3D Model Loading Screen */
#modelLoader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(16, 26, 40, 0.96) 0%, rgba(8, 13, 20, 0.99) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease;
  user-select: none;
}
#modelLoader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-spinner {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.loader-ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(251, 191, 36, 0.35);
  border-top-color: #fbbf24;
  border-right-color: #fbbf24;
  animation: loaderSpinCcw 3.2s linear infinite;
}
.loader-ring-inner {
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  border-top-color: #58a6ff;
  border-left-color: #58a6ff;
  filter: drop-shadow(0 0 6px rgba(88, 166, 255, 0.45));
  animation: loaderSpinCw 1.2s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}
.loader-core {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #58a6ff;
  box-shadow: 0 0 14px #58a6ff, 0 0 24px rgba(88, 166, 255, 0.7);
  animation: loaderPulse 1.6s ease-in-out infinite;
}
.loader-title {
  color: #f0f6fc;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .08em;
  margin-bottom: 6px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.loader-sub {
  color: #8b9bb0;
  font-size: 12px;
  letter-spacing: .04em;
  margin-bottom: 18px;
  animation: loaderPulse 2s ease-in-out infinite;
}
.loader-bar-wrap {
  width: 180px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.loader-bar-glow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, #58a6ff, #fbbf24, transparent);
  animation: loaderBarFlow 1.6s ease-in-out infinite;
}

@keyframes loaderSpinCw {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes loaderSpinCcw {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}
@keyframes loaderPulse {
  0%, 100% { opacity: 0.65; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}
@keyframes loaderBarFlow {
  0% { left: -45%; }
  100% { left: 100%; }
}

