body
{
   background-color: #FFFFFF;
   color: #000000;
   font-family: Arial;
   font-weight: normal;
   font-size: 13px;
   line-height: 1.1875;
   margin: 0;
   padding: 0;
}
:root{
  --bg:#0b1220;
  --bg2:#0f1728;
  --panel:#131c2f;
  --panel2:rgba(18,24,38,.88);
  --panel3:rgba(10,16,28,.82);
  --line:rgba(255,255,255,.08);
  --line-strong:rgba(255,255,255,.14);
  --text:#edf3ff;
  --muted:#9eabc4;
  --muted2:#7887a3;
  --accent:#5aa2ff;
  --accent2:#7c5cff;
  --accent-soft:rgba(90,162,255,.18);
  --success:#00d78a;
  --danger:#ff8576;
  --shadow:0 18px 60px rgba(0,0,0,.45);
  --shadow-soft:0 10px 28px rgba(0,0,0,.28);
  --radius:16px;
  --radius-sm:10px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family:Inter,Segoe UI,Arial,sans-serif;
  overflow:hidden;
  background:
    radial-gradient(1100px 700px at 12% 0%, rgba(80,120,255,.14), transparent 55%),
    radial-gradient(900px 700px at 100% 0%, rgba(124,92,255,.16), transparent 48%),
    linear-gradient(180deg,#0b1220 0%, #0a101c 100%);
}
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(rgba(255,255,255,.02), rgba(255,255,255,0)),
    radial-gradient(circle at center, rgba(255,255,255,.03) 0, rgba(255,255,255,0) 60%);
  mix-blend-mode:screen;
}
*::-webkit-scrollbar{width:11px;height:11px}
*::-webkit-scrollbar-track{background:rgba(255,255,255,.03);border-radius:999px}
*::-webkit-scrollbar-thumb{background:rgba(120,135,163,.45);border-radius:999px;border:2px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-thumb:hover{background:rgba(140,160,195,.72);border:2px solid transparent;background-clip:padding-box}

#app{display:flex;height:100vh;gap:0}
#view{
  flex:1;
  position:relative;
  background:
    radial-gradient(900px 700px at 20% 20%, rgba(59,130,246,.08), transparent 50%),
    linear-gradient(180deg,#0b1220 0%, #0b1324 100%);
}
#view::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size:22px 22px;
  opacity:.15;
}
canvas{display:block;width:100%;height:100%}

#panel{
  width:360px;
  background:linear-gradient(180deg, rgba(18,24,38,.94), rgba(12,17,30,.97));
  border-left:1px solid var(--line);
  padding:18px;
  overflow:auto;
  box-shadow:-10px 0 40px rgba(0,0,0,.20);
  backdrop-filter:blur(14px);
}
h1{
  margin:0 0 14px;
  font-size:22px;
  line-height:1.15;
  letter-spacing:.2px;
  color:#f5f8ff;
  font-weight:800;
}
.section{
  margin-top:14px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  box-shadow:var(--shadow-soft);
}
.label{
  font-size:12px;
  font-weight:700;
  letter-spacing:.35px;
  text-transform:uppercase;
  color:#cad5ec;
  margin:0 0 8px;
}
.small{
  font-size:12px;
  color:var(--muted);
  line-height:1.55;
}
.hint{font-size:11px;color:var(--muted2);margin-top:6px}
.row{display:flex;gap:10px;align-items:center}
.row + .row{margin-top:4px}
.row .btn{flex:1}
.inline{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.check{
  display:flex;
  align-items:center;
  gap:9px;
  font-size:12px;
  color:#d7e0f0;
  margin-top:10px;
}
input[type=checkbox]{
  width:16px;height:16px;accent-color:var(--accent);
}
input[type=number],
input[type=range],
input[type=text],
select{
  width:100%;
  color:var(--text);
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  background:rgba(10,16,28,.78);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
  outline:none;
}
input[type=number]:focus,
input[type=range]:focus,
input[type=text]:focus,
select:focus{
  border-color:rgba(90,162,255,.7);
  box-shadow:0 0 0 3px rgba(90,162,255,.15), inset 0 1px 0 rgba(255,255,255,.03);
}

select option{
  background:#0f1728;
  color:#edf3ff;
}
select option:checked,
select option:hover{
  background:#1d2b46;
  color:#ffffff;
}
#textureMaxSize{
  color:#edf3ff !important;
  background:rgba(10,16,28,.92) !important;
}
#textureMaxSize option{
  background:#0f1728 !important;
  color:#edf3ff !important;
}

input[type=range]{padding:8px}
input[type=file]{
  width:100%;
  padding:10px;
  border:1px dashed var(--line-strong);
  border-radius:12px;
  background:rgba(9,14,25,.55);
  color:var(--muted);
}

.btn{
  width:100%;
  padding:11px 14px;
  margin:4px 0;
  border:1px solid var(--line-strong);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  color:var(--text);
  border-radius:12px;
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  letter-spacing:.15px;
  box-shadow:0 6px 18px rgba(0,0,0,.22);
  transition:transform .14s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover{
  transform:translateY(-1px);
  border-color:rgba(90,162,255,.55);
  box-shadow:0 10px 28px rgba(0,0,0,.28);
  background:linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.03));
}
.btn:active{transform:translateY(0)}
.btn.primary{
  border-color:rgba(111,179,255,.45);
  background:linear-gradient(135deg, #2e7bff 0%, #5a7cff 50%, #7c5cff 100%);
  color:white;
}
.btn.primary:hover{
  border-color:rgba(160,210,255,.9);
  box-shadow:0 14px 34px rgba(53,106,255,.33);
}
.miniBtn{
  padding:7px 10px;
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
  color:var(--text);
  border-radius:10px;
  cursor:pointer;
  font-size:11px;
  font-weight:700;
  box-shadow:0 4px 12px rgba(0,0,0,.18);
  transition:.16s ease;
}
.miniBtn:hover{
  border-color:rgba(90,162,255,.55);
  background:linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.03));
}

#drop{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(7,12,20,.84);
  z-index:5;
  backdrop-filter:blur(8px);
}
#drop.hidden{display:none}
.dropbox{
  min-width:min(560px,calc(100vw - 120px));
  max-width:760px;
  border:1px dashed rgba(126,161,220,.45);
  border-radius:26px;
  padding:38px 42px;
  text-align:center;
  cursor:pointer;
  background:linear-gradient(180deg, rgba(22,31,50,.88), rgba(10,16,28,.88));
  box-shadow:0 20px 55px rgba(0,0,0,.36);
}
.dropbox:hover{
  border-color:rgba(90,162,255,.75);
  box-shadow:0 24px 65px rgba(0,0,0,.42), 0 0 0 1px rgba(90,162,255,.22) inset;
}
.big{
  font-size:28px;
  font-weight:800;
  color:#f2f7ff;
  margin-bottom:10px;
  letter-spacing:.15px;
}

#err{
  display:none;
  background:linear-gradient(180deg, rgba(110,27,27,.38), rgba(75,18,18,.28));
  border:1px solid rgba(255,133,118,.33);
  color:#ffd0c8;
  padding:13px 14px;
  border-radius:14px;
  margin-top:12px;
  white-space:pre-wrap;
  line-height:1.55;
  box-shadow:var(--shadow-soft);
}
#status{
  font-size:12px;
  color:#c7d1e5;
  margin-top:10px;
  white-space:pre-wrap;
  line-height:1.55;
  padding:11px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.035);
  border:1px solid var(--line);
}

#progressWrap{
  display:none;
  height:10px;
  background:rgba(255,255,255,.03);
  border:1px solid var(--line);
  border-radius:999px;
  margin-top:12px;
  overflow:hidden;
}
#progress{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, #40b7ff, #7c5cff);
  box-shadow:0 0 16px rgba(90,162,255,.35);
}

#framePreview{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  border:2px solid rgba(0,215,138,.95);
  box-shadow:0 0 0 1px rgba(0,0,0,.45) inset, 0 0 22px rgba(0,215,138,.35);
  pointer-events:none;
  z-index:3;
  display:none;
}
#frameCenterMark{
  position:absolute;
  left:50%;
  top:50%;
  width:22px;
  height:22px;
  transform:translate(-50%,-50%);
  pointer-events:none;
}
#frameCenterMark::before,#frameCenterMark::after{
  content:'';
  position:absolute;
  left:50%;
  top:50%;
  background:var(--success);
  box-shadow:0 0 8px rgba(0,215,138,.8);
}
#frameCenterMark::before{width:2px;height:22px;transform:translate(-50%,-50%)}
#frameCenterMark::after{width:22px;height:2px;transform:translate(-50%,-50%)}
#framePreviewLabel{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  background:rgba(5,12,20,.92);
  color:#dffcf0;
  border:1px solid rgba(0,215,138,.42);
  border-radius:0 0 10px 0;
  padding:5px 8px;
  font:12px monospace;
  pointer-events:none;
  z-index:4;
  display:none;
  white-space:nowrap;
}

#polyReducerSection{border-color:rgba(235,155,43,.22)}
#polyReducerSection .primary{
  background:linear-gradient(135deg, #d37a00 0%, #f39b18 100%);
  border-color:rgba(255,190,92,.55);
}
#polyReducerSection .primary:hover{
  border-color:rgba(255,214,152,.8);
  box-shadow:0 14px 34px rgba(188,111,0,.28);
}

.camValueBox{
  background:linear-gradient(180deg, rgba(9,14,25,.92), rgba(14,20,34,.84));
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  color:#f5f8ff;
  font:700 22px/1.1 ui-monospace,SFMono-Regular,Consolas,monospace;
  text-align:center;
  margin-top:6px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}

#modelExplorer{
  position:absolute;
  left:16px;
  top:16px;
  width:300px;
  max-height:calc(100vh - 32px);
  overflow:auto;
  background:linear-gradient(180deg, rgba(20,28,44,.92), rgba(10,15,26,.92));
  border:1px solid rgba(255,255,255,.09);
  border-radius:20px;
  padding:14px;
  z-index:4;
  box-shadow:0 18px 50px rgba(0,0,0,.38);
  backdrop-filter:blur(14px);
}
#modelExplorerTitle{
  font-size:14px;
  color:#f4f8ff;
  font-weight:800;
  letter-spacing:.25px;
  margin-bottom:10px;
}
#modelExplorer .rowTools{display:flex;gap:8px;margin-bottom:10px}
#modelExplorerList{display:flex;flex-direction:column;gap:8px}
#alwaysDropArea{
  border:1px dashed rgba(126,161,220,.45);
  border-radius:16px;
  padding:14px;
  margin-bottom:12px;
  text-align:center;
  background:linear-gradient(180deg, rgba(13,20,34,.92), rgba(10,16,28,.84));
  color:#d7e2f2;
  font-size:12px;
  cursor:pointer;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}
#alwaysDropArea:hover,#alwaysDropArea.dragHot{
  border-color:rgba(90,162,255,.75);
  color:#ffffff;
  background:linear-gradient(180deg, rgba(25,36,58,.94), rgba(12,18,31,.90));
}
.modelCheck{accent-color:var(--accent)}
.modelItem{
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  padding:10px;
  background:linear-gradient(180deg, rgba(255,255,255,.048), rgba(255,255,255,.02));
  box-shadow:0 8px 22px rgba(0,0,0,.18);
  transition:border-color .16s ease, transform .14s ease, background .16s ease;
}
.modelItem:hover{
  transform:translateY(-1px);
  border-color:rgba(90,162,255,.35);
}
.modelItem.activeModelItem{
  border-color:rgba(90,162,255,.68);
  box-shadow:0 0 0 1px rgba(90,162,255,.28) inset, 0 12px 26px rgba(0,0,0,.22);
  background:linear-gradient(180deg, rgba(46,123,255,.15), rgba(255,255,255,.03));
}
.modelItemHeader{display:flex;align-items:center;gap:10px}
.modelItemName{
  flex:1;
  font-size:12px;
  font-weight:700;
  color:#f0f4ff;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.modelItemSub{
  font-size:11px;
  color:var(--muted);
  margin-top:4px;
}
.hiddenHint{opacity:.6}

#floatingTools{
  position:absolute;
  right:18px;
  top:18px;
  width:560px;
  min-width:340px;
  min-height:84px;
  max-width:calc(100vw - 388px);
  max-height:82vh;
  overflow:auto;
  resize:both;
  background:linear-gradient(180deg, rgba(18,24,38,.94), rgba(10,14,24,.94));
  border:1px solid rgba(255,255,255,.10);
  border-radius:22px;
  box-shadow:0 24px 70px rgba(0,0,0,.42);
  z-index:6;
  backdrop-filter:blur(16px);
}
#floatingToolsHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 16px;
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border-bottom:1px solid var(--line);
  border-radius:22px 22px 0 0;
  cursor:move;
  user-select:none;
  position:sticky;
  top:0;
  z-index:1;
  backdrop-filter:blur(12px);
}
#floatingToolsTitle{
  font-size:14px;
  font-weight:800;
  color:#f7faff;
}
#floatingToolsHeaderRight{display:flex;align-items:center;gap:8px}
#floatingToolsFoldBtn{
  padding:7px 12px;
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  color:var(--text);
  border-radius:10px;
  cursor:pointer;
  font-size:12px;
  font-weight:700;
}
#floatingToolsFoldBtn:hover{
  border-color:rgba(90,162,255,.55);
}
#floatingToolsBody{padding:14px}
#floatingResizeHint{
  position:absolute;
  right:10px;
  bottom:6px;
  color:rgba(255,255,255,.45);
  font-size:14px;
  pointer-events:none;
}
#floatingTools.collapsed{
  width:290px;
  min-height:auto;
  max-height:none;
  overflow:hidden;
  resize:none;
}
#floatingTools.collapsed #floatingToolsBody{display:none}
#floatingTools.collapsed #floatingResizeHint{display:none}

.tabBar{
  display:flex;
  gap:8px;
  margin:0 0 12px;
  padding:5px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.03);
}
.tabBtn{
  flex:1;
  padding:10px 12px;
  border:1px solid transparent;
  background:transparent;
  color:#d7e0f2;
  border-radius:11px;
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  transition:.16s ease;
}
.tabBtn:hover{
  color:#fff;
  background:rgba(255,255,255,.04);
}
.tabBtn.active{
  color:white;
  background:linear-gradient(135deg, #2e7bff 0%, #7c5cff 100%);
  box-shadow:0 8px 24px rgba(70,100,255,.28);
}

.exportTabSection{display:none}
.exportTabSection.active{display:block}

#apngPreviewWrap{
  --apng-preview-aspect: 1 / 1;
  overflow:hidden;
  background:linear-gradient(180deg, rgba(9,14,25,.95), rgba(16,23,38,.88));
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
  margin-top:10px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}
#apngCanvas{
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:var(--apng-preview-aspect);
  background:
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%) 0 0/18px 18px,
    linear-gradient(-45deg, rgba(255,255,255,.05) 25%, transparent 25%) 0 0/18px 18px,
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.05) 75%) 0 0/18px 18px,
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.05) 75%) 0 0/18px 18px,
    #111827;
  border:1px solid var(--line);
  border-radius:14px;
}
#apngNativeImg{
  display:none;
  width:100%;
  height:auto;
  aspect-ratio:var(--apng-preview-aspect);
  background:
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%) 0 0/18px 18px,
    linear-gradient(-45deg, rgba(255,255,255,.05) 25%, transparent 25%) 0 0/18px 18px,
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.05) 75%) 0 0/18px 18px,
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.05) 75%) 0 0/18px 18px,
    #111827;
  border:1px solid var(--line);
  border-radius:14px;
}
#apngInfo{
  font-size:12px;
  color:var(--muted);
  margin-top:8px;
  word-break:break-word;
}
